I encountered this problem while setting up this website. I created 2 virtual hosts in:
/etc/apache2/sites-available/
- kbomb
- phpmyadmin
kbomb Virtual Host:
DocumentRoot /var/www/kbomb/public_html
ServerName kbomb.com.au
ServerAlias http://www.kbomb.com.au/
ErrorLog /var/log/apache2/kbomb.com.au-error.log
CustomLog /var/log/apache2/kbomb.com.au-acce ss.log combined
phpmyadmin Virtual Host:
DocumentRoot /usr/share/phpmyadmin
ServerName phpmyadmin.kbomb.com.au
ErrorLog /var/log/apache2/phpmyadmin.kbomb. com.au-error.log
CustomLog /var/log/apache2/phpmyadmin.kbomb. com.au.log combined
Whenever i went to kbomb.com.au, http://www.kbomb.com.au/ or phpmyadmin.kbomb.com.au i would get the same website.
With a bit of research here is my findings...
Because my debian server has 3 static IP addresses and does routing, Apache2 doesnt know which interface the Virtual Hosts are to work on. You need to define them in /etc/apache2/apache2.conf.
If you want your Virtual Hosts working on just 1 IP Address you would want to enter:
NameVirtualHost 202.89.160.16:80
If you would like your Virtual Hosts working on all network interfaces you want to define a wildcard. This is the most practical method unless you want to lock certain network interfaces from viewing your websites.
NameVirtualHost *
I wacked this line at the end of my apache2.conf file just before Include /etc/apache2/sites-enabled/.
So the end of my file looks like:
NameVirtualHost *
# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/
This fixed my problem
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment