Hey everyone,
I'm having an issue with setting up the virtual hosts on my web server. I have 2 virtual hosts (example1.com, example2.com). example1.com works but example2.com is sent to the index file of example1.com. I did some searching on google and it seems the problem might be with my /etc/hosts file.
First virtual host that the second is also directed to...in sites-available/sites-enabled (note port 80 is blocked by my isp so I use 8080)
Code:
#
# example1.com (/etc/apache2/sites-available/www.example.com)
#
<VirtualHost *:8080>
ServerAdmin billjohnston4@gmail.com
ServerName example1.com
ServerAlias example1.com *.example1.com
# Indexes + Directory Root.
DirectoryIndex index.html
DocumentRoot /var/www/example1.com/htdocs/
# CGI Directory
ScriptAlias /cgi-bin/ /var/www/example1.com/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /var/www/example1.com/logs/error.log
CustomLog /var/www/example1.com/logs/access.log combined
</VirtualHost>
Second virtual host file
Code:
#
# example2.com (/etc/apache2/sites-available/example2.com)
#
<VirtualHost *:8080>
ServerAdmin billjohnston4@gmail.com
ServerName example2.com
ServerAlias example2.com *.example2.com
# Indexes + Directory Root.
DirectoryIndex index.html
DocumentRoot /var/www/example2.com/htdocs/
# CGI Directory
ScriptAlias /cgi-bin/ /var/www/example2.com/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /var/www/example2.com/logs/error.log
CustomLog /var/www/example2.com/logs/access.log combined
</VirtualHost>
and my hosts file
Code:
127.0.0.1 localhost.localdomain localhost
192.168.1.1 server1.example2.com server1
127.0.0.1 example2.com
127.0.0.1 example1.com
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
Also I'm using a dyndns.org...would that make a difference?
Any help on this would be greatly appreciated
Thanks,
Bill