Results 1 to 4 of 4
Hi Guy's, please go easy on me, I'm new to this Linux game and these forums
I have a server running CentOS 5.5 and Apache 2.2.3. It has 2 NIC's ...
- 12-30-2010 #1Just Joined!
- Join Date
- Dec 2010
- Posts
- 7
[SOLVED] 1 IP 2 Sites?
Hi Guy's, please go easy on me, I'm new to this Linux game and these forums

I have a server running CentOS 5.5 and Apache 2.2.3. It has 2 NIC's but only one is currently in use. The NIC in use has a LAN IP address and the default gateway points to a router that has 1 WAN IP address and ports 80 and 443 forwarded to the LAN IP of the NIC.
I have 2 installations of Wordpress installed at /srv/vhosts/ i.e:
/srv/vhosts/blog.wordpress1.co.uk/htdocs
/srv/vhosts/www1.wordpress2.net/htdocs
I have 2 virtual hosts in Apache that point to one of these installations each. The Virtual hosts have their own configuration files in a self created directory in:
/etc/httpd/vhosts.d/
The conf files are named:
blog.wordpress1.co.uk.conf
www1.wordpress2.net.conf
Within httpd.conf I have added a line to include any .conf files in /etc/httpd/vhosts.d/*.conf so that the aliases are loaded when Apache starts.
OK, now here is the problem. Within a browser if I go to blog.wordpress1.co.uk I get the correct installation of Wordpress. However, if I go to www1.wordpress2.net I get the same installation. Here is the contents of each virtual hosts .conf file.
<VirtualHost *:80>
DocumentRoot "/srv/vhosts/blog.wordpress2.co.uk/htdocs"
ServerName blog.wordpress1.co.uk
<Directory "/srv/vhosts/blog.wordpress1.co.uk/htdocs">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/srv/vhosts/www1.wordpress2.net/htdocs"
ServerName www1.wordpress2.net
<Directory "/srv/vhosts/www1.wordpress2.net/htdocs">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
Any help would be greatly appreciated. Please note blog.wordpress1.co.uk and www1.wordpress2.net are not the actual domains in use. I also had to use the host header www1 instead of www as the forum software won't let me post URL's.
Thanks
Tom
- 12-30-2010 #2
Does your apache conf contain the directives
- Listen 0.0.0.0:80
- NameVirtualHost 0.0.0.0:80
before the virthosts?
Also, the port is actually 80, right?
And not 443. Or more precise: https.
As multiple hosts on one IP is tricky and also requires not only serverconfiguration.You must always face the curtain with a bow.
- 12-30-2010 #3Just Joined!
- Join Date
- Dec 2010
- Posts
- 7
- 12-30-2010 #4Just Joined!
- Join Date
- Dec 2010
- Posts
- 7
I am such an idiot

I found this commented out in httpd.conf
# Use name-based virtual hosting.
#
NameVirtualHost *:80#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.



