View previous topic :: View next topic |
Author |
Message |
milothurston Apprentice
Joined: 01 May 2002 Posts: 231 Location: Oxford, England.
|
Posted: Sat May 27, 2006 9:36 pm Post subject: Apache virtual hosts configuration |
|
|
I'm setting up a server that should have two sites on it, using name-based virtual hosts. The relevant section of my httpd.conf file looks like this:
Code: |
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.default_site.org
DocumentRoot /var/www/vhosts/default
DirectoryIndex index.php index.html
</VirtualHost>
<VirtualHost *:80>
ServerName www.other_site.org
DocumentRoot /var/www/vhosts/other_site.org
DirectoryIndex index.php index.html
ErrorLog logs/other_site-error_log
CustomLog logs/other_site-access_log common
</VirtualHost>
|
There are two problems.
1. Any incoming traffic to www.other_site.org shows the index.html file in /var/www/vhosts/site1/htdocs.
2. The site2 logs are empty - everything goes into the default logs.
The docs at http://httpd.apache.org/docs-2.0/vhosts/ (if I've understood them) seem to suggest that I've got that config right, but the results suggest otherwise. Is there anything obvious that I've missed? |
|
Back to top |
|
|
ikaro Advocate
Joined: 14 Jul 2003 Posts: 2527 Location: Denmark
|
Posted: Sat May 27, 2006 11:04 pm Post subject: |
|
|
Hi there
Some background information:
In my box, the ip of machine (http://localhost) shows one site, while www.site.tld and www.site2.tld show diferent sites.
I also use test.site.tld and test.site2.tld in my setup.
Here are some working examples from my vhosts file:
Code: |
NameVirtualHost *:80
<IfDefine DEFAULT_VHOST>
<VirtualHost *:80>
ServerName xxx.xxx.xxx.xx
ServerAlias xxx.xxx.xxx.xx
DocumentRoot "/var/www/localhost/htdocs"
<Directory "/var/www/localhost/htdocs">
Options FollowSymLinks Indexes
AllowOverride Indexes
Order allow,deny
Allow from all
</Directory>
<IfModule peruser.c>
ServerEnvironment apache apache
MinSpareProcessors 4
MaxProcessors 20
</IfModule>
</VirtualHost>
</IfDefine>
<VirtualHost *:80>
ServerName www.site.tld
ServerAlias fluxmod.dk
DocumentRoot "/var/www/site.tld"
<Directory "/var/www/site.tld">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/www/site.tld/logfiles/error.log
CustomLog /var/www/site.tld/logfiles/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName www.site.tld
ServerAlias ikaro.dk
DocumentRoot "/var/www/site.tld"
<Directory "/var/www/site.tld">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/www/site.tld/logfiles/error.log
CustomLog /var/www/site.tld/logfiles/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName www.test.site.tld
ServerAlias test.site.tld
DocumentRoot "/var/www/www.test.site.tld"
<Directory "/var/www/test.site.tld/">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/www/test.site.tld/logfiles/error.log
CustomLog /var/www/test.site.tld/logfiles/access.log combined
</VirtualHost>
|
Hope it helps _________________ linux: #232767 |
|
Back to top |
|
|
milothurston Apprentice
Joined: 01 May 2002 Posts: 231 Location: Oxford, England.
|
Posted: Sun May 28, 2006 2:03 pm Post subject: |
|
|
Fixed now, thanks. Apparently an extra VirtualHost directive had crept in elsewhere in the httpd.conf file. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|