[NTLUG:Discuss] Virtual Host in Apache (LONG)

MadHat madhat at unspecific.com
Thu Aug 26 13:12:11 CDT 1999


Keith From wrote:
> 
> ----- Original Message -----
> From: MadHat <madhat at unspecific.com>
> To: <discuss at ntlug.org>
> Sent: Thursday, August 26, 1999 12:42 PM
> Subject: Re: [NTLUG:Discuss] Virtual Host in Apache (LONG)
> 
> > MadHat wrote:
> > >
> > > Keith From wrote:
> > > > >
> > >
> > > You may want to look at
> > > http://www.apache.org/docs/vhosts/index.html
> > >
> > > I will try to answer what I remember.
> > >
> > > >
> > > > OK, this brings up another question about the "NameVirtualHost
> > > > 209.223.22.92:80"
> > > >
> > > > If I were to have 5 sites going under Apache, would i need to do
> > > > something like this????
> > > >
> > > > NameVirtualHost 209.223.22.92:80
> > > > NameVirtualHost 209.223.22.93:80
> > > > NameVirtualHost 209.223.22.94:80
> > > > NameVirtualHost 209.223.22.95:80
> > > > NameVirtualHost 209.223.22.96:80
> > > >
> > >
> > > I haven't set it up this way before, with multiple NameVirtualHost
> > > entries, but I think it will complain.  If you are wanting to use more
> > > than 1 IP for multiple sets of virtual hosts, you may have to run
> > > ddifferent instances of Apache.  I know you have have 1 set of virtual
> > > hosts and the use IPs for other sites on the same apache, but not
> > > multiple sets of VHs.  I didn't see anything about it in the docs.
> > >
> >
> > damn I can't type a complete sentence...
> >
> > OK, if you have 5 IPs and you want to have 5 domains, put them on
> > seperate IPs, if you have 1 IP and 5 domains, use the NameVirtualHost
> > and use the 1 IP for all 5.  If you have say 2 IPs and you want 3
> > domains on one IP and 2 on the other IP, you would have to use more than
> > one instance of httpd (apache).  But if you just have 3 IPs and 5
> > domains, you can have 1 domain point to the first IP, the next domain
> > point to the next IP and have the last 3 domains point to the last IP
> > (and use the NameVirtualHost on that IP) without running more than one
> > instance of apache.
> >
> > Does that make sence? Or better yet, does that answer the question/solve
> > the problem?
> >
> > --
> > MadHat
> >
> > _______________________________________________
> > http://ntlug.org/mailman/listinfo/discuss
> >
> Yes, this makes sence. here is a copy of the httpd.conf file
> that I am writing right now. I haven't tested it yet, but hopefully it will
> work. What do you think. Also, I guess i had better put all of
> the AddModule lines and such back in.

Only add the ones you find usefull.  If you are not sure what they do,
check the apache site.  (I know I like spelling, the module, not the
real thing)

> 
> ####
> # Configuration dumper for Comanche. It can be configured, so the .conf is
> human friendly
> ####
> 
> User webuser
> Group webgroup
> 
> #Timeout 300
> #minspareservers 8
> #maxspareservers 20
> #startservers 10
> #MaxClients 150
> #maxrequestsperchild 100

whith these commented out it will use the defaults.  You can tweek the
server by uncommenting them and changing them, but it depends on what
type of content is being served to what setting will help.

> 
> <VirtualHost 209.223.22.92>
> ServerAdmin webmaster at mail.cbssolutions.com
> DocumentRoot /files/www/cbs/pub/html
> ServerName www.cbssolutions.com
> ErrorLog /files/www/cbs/pub/logs/error_log
> TransferLog /files/www/cbs/pub/logs/access_log
> #<directory "/files/www/cbs/pub/html">
> #Options Indexes Includes FollowSymLinks
> #AllowOverride None
> #order allow,deny
> #allow from all
> #</directory>
> </Virtualhost>

With the dir stuff commented out it will use the rights on the next dir
defined above it, if there isn't one, it will go al the way back to /
wich can cause some problems.  Just depends on the content.

> 
> <VirtualHost 209.223.22.93>
> ServerAdmin webmaster at mail.cbssolution.com
> DocumentRoot /files/www/testing/htdocs
> Servername www.testing.com
> ErrorLog /files/www/testing/logs/error_log
> TransferLog /files/www/testing/logs/access_log
> </VirtualHost>

Should work.  


NOTE: add a line to the virtualhost stuff like this:

ServerAlias testing.com www.testing.com this.is.testing.com

that way is you point www and just testing.com to the same IP they will
go to the same site, otherwise it will go to the default site.  The last
entry is just to show you can add as many aliases as you want.

This is what one of mine looks like.

<VirtualHost 206.190.46.20>     
	ServerAdmin lheath at broadcast.com     
	DocumentRoot /usr/local/virtual/danielash.org/www     
	ServerName danielash.org     
	ServerAlias  danielash.org www.danielash.org     
	ErrorLog "|/usr/local/apache/bin/rotatelogs
/usr/local/virtual/danielash.org
/logs/error_log 86400"     
	CustomLog "|/usr/local/apache/bin/rotatelogs
/usr/local/virtual/danielash.or
g/logs/access_log 86400" common     
	ScriptAlias /cgi-bin/ "/usr/local/virtual/danielash.org/cgi-bin/"     
	<Directory "/usr/local/virtual/danielash.org/www">         
		AllowOverride AuthConfig     
	</Directory>     
	<Directory "/usr/local/virtual/danielash.org/cgi-bin">         
		AllowOverride AuthConfig         
		Options None         
		Order allow,deny         
		Allow from all
	</Directory>
</VirtualHost>

-- 
MadHat




More information about the Discuss mailing list