[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:
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:
The conf files are named:
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.
allow from all
allow from all
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.
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.
Hi, thanks for the reply. I take it that by "apache conf" you mean httpd.conf? If so I will check that.
Originally Posted by Irithori
Yes port 80 is what I am after.
I am such an idiot :(
I found this commented out in httpd.conf
# Use name-based virtual hosting.
# 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.