Possible Duplicate:
Multiple vhosts on multiple IP addresses
I'm running Ubuntu 11.10, I have two IP addresses assigned to my VPS (Linode).
I have followed their guide to enable static addresses (can be found here: http://www.linode.com/wiki/index.php/Configure_Static_IPs)
The current situation is that I have 3 websites on that Linode and I want to set them up so site1 and site2 will use IP1 and site3 will use IP3
/etc/apache2/sites-available/site1.com
<VirtualHost 1.1.1.1:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin info@site1.com
ServerName site1.com
ServerAlias www.site1.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/site1/public_html
# Custom log file locations
LogLevel warn
ErrorLog /home/site1/public_html/log/error.log
CustomLog /home/site1/public_html/log/access.log combined
</VirtualHost>
/etc/apache2/sites-available/site2.com
<VirtualHost 1.1.1.1:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin info@site2.com
ServerName site2.com
ServerAlias www.site2.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/site2/public_html
# Custom log file locations
LogLevel warn
ErrorLog /home/site2/public_html/log/error.log
CustomLog /home/site2/public_html/log/access.log combined
</VirtualHost>
/etc/apache2/sites-available/site3.com
<VirtualHost 2.2.2.2:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin info@site3.com
ServerName site3.com
ServerAlias www.site3.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/site3/public_html
# Custom log file locations
LogLevel warn
ErrorLog /home/site3/public_html/log/error.log
CustomLog /home/site3/public_html/log/access.log combined
</VirtualHost>
Relevant excerpt from ports.conf:
NameVirtualHost 1.1.1.1:80
NameVirtualHost 2.2.2.2:80
Listen 1.1.1.1:80
Listen 2.2.2.2:80
Problem is, I'm getting the content of site1 on all three sites. I have no idea why this is happening. Can you please assist?
Note: I have ran a2ensite for all 3 websites, no errors/warnings appear when i start the apache2 service.
/etc/init.d/apache2 virtualhosts? That's the command on Gentoo, I'm not sure if it would work on Ubuntu as well but it's worth a shot. It should print out the entire vhost configuration as parsed from the config files, which will let you check directly whether your configurations are being parsed correctly. – David Zaslavsky Jan 2 at 22:59