From owner-freebsd-questions@FreeBSD.ORG Sun Mar 18 04:02:05 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CADDA1065675 for ; Sun, 18 Mar 2012 04:02:05 +0000 (UTC) (envelope-from aimass@yabarana.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 93C4A8FC0A for ; Sun, 18 Mar 2012 04:02:04 +0000 (UTC) Received: by iahk25 with SMTP id k25so10524851iah.13 for ; Sat, 17 Mar 2012 21:02:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=BmZJvqkX9pPAdbQFeLMZaj7ILzd26aFMiDuXBXIbWTA=; b=GTPUhn43CP8R2DHIa6EeX0JtqxR7qvfvcXspbUVNoAZwwOyVSrMymihRJprTpNHyJt COLmuCn55mnhi8JjxizuaKqX732RhKV0WYhgZY8DxGaIqiApvuz+SJwwk3rcCN5Aa9+E OJ+s39ZLko8nnCkTQpUjm9PaKfoKbXsIykb1G3g9ZP7ECgzN2okEX+1j5MStCDoY9nd5 oS9qSVmzEstnsxC9RQ7gAuyzWRYJrlI7UazuQcYWDdwqP1fNBuRs8LqkdG6/5ILg/vSq LGdLp3VYbfsy8EsIPkmC/Vldu9mkxYLhnCvWrWKBoxdtiVl8HlMnTYmnYzeMbYjov4vm MJtw== MIME-Version: 1.0 Received: by 10.50.157.165 with SMTP id wn5mr2976096igb.64.1332043324061; Sat, 17 Mar 2012 21:02:04 -0700 (PDT) Sender: aimass@yabarana.com Received: by 10.231.74.138 with HTTP; Sat, 17 Mar 2012 21:02:03 -0700 (PDT) In-Reply-To: <4F64BDEF.3030602@googlemail.com> References: <4F64BDEF.3030602@googlemail.com> Date: Sun, 18 Mar 2012 00:02:03 -0400 X-Google-Sender-Auth: 800lLhWBJgnVPx_0_SLXO1UxSN8 Message-ID: From: Alejandro Imass To: David Hughes Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQkdAGIiNI9h1Ef5skrEVUhqXh0A6t5GqHS7eX/VsRsZFs1R9zMtALgFmkzyeLvnJCN9Yen9 Cc: freebsd-questions@freebsd.org Subject: Re: Virtual Hosts & Subdomains X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 04:02:05 -0000 On Sat, Mar 17, 2012 at 12:38 PM, David Hughes wrote: > Hi all, > > thanks very much for your advice. > To answer your questions: > > It's a FreeBSD jail that I rent from Exonetric, which I've been using for > experimental / developmental purposes. I haven't registered a personal > domain name for it - as it's mainly for me to mess about with than for the > world to see - but it is bound to a public IP and generic domain name > (http://jail0152.vps.exonetric.net/). I don't have access to the domain name > that came with the jail - and I think that is probably where the problem > lies. > > Here's the current text of my httpd.conf: > http://pastebin.com/NSaj8YfS > > Output of ifconfig: > > http://pastebin.com/Gke651xt > > > I tried adding additional entries for subdomains, but it > didn't work - although I think I understand why that is now. > > Me having this jail is mostly an exercise in learning the whys and > wherefores of remote Unix[-like] server administration - something tells me > I need to learn more about the workings of DNS, as I'd never heard of CNAMEs > before. > OK. First of all you should do it correctly and go by the file distribution of the Apache 2 port. Stick to pre-defined httpd.conf and just uncomment the virtual host file towards the end of the file. Then in extras/httpd-vhosts.conf is where you should configure you vhosts. Once you go for virtual hosts the everything should be vhosts, you should not mix-match single httpd settings with vhost settings. From the on you should use the extra/ httpd and ssl vhosts in separate files like it's pre-defined in the port. >From your example I am assuming you want name-based vhost. Leave the first vhost pointing to something default and safe. Apache will default to the very first vhost defined if it cannot match a domain name. Realize that vhost is an http 1.1 feature, meaning that the vhost mapping is resolved by the domain name in the http request. So even though several domains may map to the same IP, when the request reaches Apache it will look in it's vhost table and try to match a domain name defined in one of the vhosts. If it cannot find one it will default to the first one. This is very confusing and it's always safe to leave the first one pointing something default, maybe even a 404 response. You don't need to use the hoster's provided domain name, in fact you shouldn't. I suspect you have your own domains so just make them point to the IP of jail0152.vps.exonetric.net which seems to resolve to 178.250.76.43 So make __your__ domains point to that IP in your DNS (A records). I can't seem to find your NameVirtualHost XXXX which is CRUCIAL for vhosts to work. Another reson to use extra/httpd-vhosts.conf Each vhost should match the exact definition of the NameVirtualHost XXXX line so for a line NameVirtualHost *:80 your vhost tags must be Then just match the domain name with the lines for example: ServerName www.yourdomain.com ServerAlias yourdomain.com you can put as many aliases as you want to match. The above will match even if the user forgot the www That's about it. If you use the files provided in FBSD it's easy peasy but if step out the suggested file distribution then you will surely get into trouble unless you really know what you're doing. The port maintainer(s) usually get it right so follow the suggested config structure ;-) post back if you get it working or if you need further help! -- Alejandro > > Thanks again for all your help, much appreciated. > > Best regards, > > David > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"