From owner-freebsd-questions@FreeBSD.ORG Mon May 19 07:12:52 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B866637B401 for ; Mon, 19 May 2003 07:12:52 -0700 (PDT) Received: from clunix.cl.msu.edu (clunix.cl.msu.edu [35.9.2.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1693C43FA3 for ; Mon, 19 May 2003 07:12:52 -0700 (PDT) (envelope-from jerrymc@clunix.cl.msu.edu) Received: from clunix.cl.msu.edu (localhost [127.0.0.1]) by clunix.cl.msu.edu (8.12.9/8.12.9) with ESMTP id h4JECpOg014050; Mon, 19 May 2003 10:12:51 -0400 (EDT) Received: (from jerrymc@localhost) by clunix.cl.msu.edu (8.12.9/8.12.9/Submit) id h4JECo4A014049; Mon, 19 May 2003 10:12:50 -0400 (EDT) From: Jerry McAllister Message-Id: <200305191412.h4JECo4A014049@clunix.cl.msu.edu> To: unixparse@yahoo.com (Matthew L) Date: Mon, 19 May 2003 10:12:50 -0400 (EDT) In-Reply-To: <20030518033308.13563.qmail@web9505.mail.yahoo.com> from "Matthew L" at May 17, 2003 08:33:08 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: questions@freebsd.org Subject: Re: Regarding Virtual Hosts & Domains X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 May 2003 14:12:53 -0000 > > Hi, > > This e-mail is regarding setting up virtual hosts and hosting more then > one domain on my freebsd machine. I currently registered two domains and i > was wondering how i would host both domains on my computer so both domains > can point to separate index.html pages and be totally independent of each > other. Example: so www.mydomain.com points to a different site > then www.mydomain2.com would this be done my adding entries into the > namedb directory. Also, i know that virtual hosts has to be done within > httpd.conf but i'm not to sure how to go about that. Any clue on how i can > go about setting up virtual hosts along with having multiple domains being > hosted off my local machine instead of someone else. Thank you, all advice > is welcome. Look forward to hearing from some people. Once again all ideas > are greatly apperciated. *** First of all, please break your lines at about 72 characters. It makes *** it much easier to respond - and that's what you want, don't you? Secondly, there are examples of virtual hosts at the end of the httpd.conf file that is delivered with Apache. Third, but, since they may be a little overkill and thus hard to understand, here is something of an example of ones we use on the servers we support, many of which have lots of virtual hosts. Note: we use a separate IP address for each on most of the sites so this example assumes that. It is not necessary but the setup is a little different. in /etc/rc.conf: - The netmask for aliases for a NIC that has already been config-ed with its main address is always 255.255.255.255 - Aliases for a given NIC need to be numbered in order with none left out - alias0 alias1, etc. Example rc.conf entries: # main config for fxp0 ifconfig_xl0="inet 33.3.3.3 netmask 255.255.255.0" # virtual host IP and web server for mydom2.com ifconfig_fxp0_alias0="33.3.3.32 netmask 255.255.255.255" Note: You don't need all the alias stuff so nuke or # comment out what you don't need. Customize the configuration as needed as per options and handlers, etc. Note: Using separate IPs requires alias entries in /etc/rc conf for each. after the first. Note: You need to make a directory to hold stuff for mydom2 somewhere. I will assume you have an id called mydom2 and that it is /home/mydom2 and that in that id's home directory you have created a .../web directory. Listen 33.3.3.32:80 ServerAdmin mydom2@www.mydom2.com DocumentRoot /home/mydom2/web ServerName www.mydom2.com ErrorLog /home/mydom2/logs/error_log CustomLog /home/mydom2/logs/access_log common CustomLog /home/mydom2/logs/referer_log referer CustomLog /home/mydom2/logs/agent_log agent Alias /icons /home/mydom2.local/web/documents/images Alias /images /home/mydom2.local/web/documents/images Alias /reports /home/mydom2/reports Alias /mois /home/mydom2/web Alias /~mois /home/mydom2/web ScriptAlias /cgi-bin/ /home/mydom2/cgi-bin/ AccessFileName .htaccess AddHandler server-parsed .html AddType text/html .html Options +Includes AllowOverride All Hope this helps, ////jerry > > Regards, Matthew. >