From owner-freebsd-questions Sat Apr 22 0:23:27 2000 Delivered-To: freebsd-questions@freebsd.org Received: from ren.sasknow.com (ren.sasknow.com [207.195.92.131]) by hub.freebsd.org (Postfix) with ESMTP id B150A37B66E for ; Sat, 22 Apr 2000 00:23:23 -0700 (PDT) (envelope-from ryan@sasknow.com) Received: from localhost (ryan@localhost) by ren.sasknow.com (8.9.3/8.9.3) with ESMTP id BAA21686; Sat, 22 Apr 2000 01:24:09 -0600 (CST) (envelope-from ryan@sasknow.com) Date: Sat, 22 Apr 2000 01:24:09 -0600 (CST) From: Ryan Thompson To: webmaster Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Web Server In-Reply-To: <200004220648.CAA21492@rustikat.com> Message-ID: Organization: SaskNow Technologies [www.sasknow.com] MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG webmaster wrote to freebsd-questions@FreeBSD.ORG: > Gentlemen > I have a web server set up using the FreeBSD OS > I need to create a virtual site > www.mydomain.com > Can't find instructions on how to do this > Please help a newbie > Thanks > Fred The Apache documentation would be an excellent place to start. It should be installed on your system. If not, it can be found under http://www.apache.org/ Virtual hosting is a broad topic with an assortment of different "options" in terms of implementation. Perhaps the most important distinction is the difference between name-based virtual hosting (many domains on one IP address), or IP based virtual hosting (one-to-one mapping of domain to IP address). Unless you are an ISP with your own large block of addresses, or your ISP has delegated a fairly large block to you, you will probably want to utilize name-based virtual hosting. As well, name-based virtual hosting typically uses far fewer file handles and socket bindings, so it is generally easier on system resources. It also preserves network addresses. As an example of name based virtual hosting, we will assume you have a public network address 172.16.0.1 (actually, that's a non Internet-routable private address. Please don't use it ;-) You currently have www.currentdomain.com pointed at 172.16.0.1. Now, you also have www.mydomain.com pointed at 172.16.0.1. This is a DNS issue. If you do your own DNS, you will of course have to create a zone file for mydomain.com and point the 'www' host to 172.16.0.1. If your ISP does your DNS for you, kindly ask them to do the same. The convention is often to also point mydomain.com at the same address for virtual hosts. (So they both forward resolve to 172.16.0.1). The reverse entry for name based virtuals is often nonsensical. :-) It should usually resolve to a host at your "primary" corporate domain. DNS is beyond the scope of your query, and this message, so please ask if you have a specific problem with hostname lookups. Now, in your httpd.conf, you need to add a container, something like the following: # The following line causes Apache to listen on the given network # address and port number. The :80 is usually implied, unless you've # told Apache to bind to a nonstandard port in the default container. NameVirtualHost 172.16.0.1:80 ServerAdmin webmaster@mydomain.com DocumentRoot /www/mydomain/public_html ServerName www.mydomain.com ServerAlias mydomain.com Note that you can also add things like custom logs, scriptaliases, and locations inside containers. Consult the Apache documentation for examples and further instructions. Of course, after adding those lines to httpd.conf, you will need to restart Apache. Running `apachectl graceful` will nicely tell Apache to reload its config files and restart server processes as they become idle. Hope this helps, - Ryan -- Ryan Thompson Systems Administrator, Accounts Phone: +1 (306) 664-1161 SaskNow Technologies http://www.sasknow.com #106-380 3120 8th St E Saskatoon, SK S7H 0W2 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message