Two hostnames in the same webserver
Posted: 18. July 2007 10:00
I have several websites in the root of my linux server (mantis, dotproject, etc), and I access them from a Windows XP machine typing "http://myserver/mantis", "http://myserver/dotproject", etc.
Also I have a project made with Symfony that I would like to access with a different name, for example "http://mysymfonyproject", but it doesn't work (it says the server was not found).
Here's my apache2.conf configuration:
But then I type this in my Windows XP machine:
And it doesn't find the server.
But if I modify the HOSTS file in my Windows XP machine adding this:
Then it works, BUT... both are pointing to the same IP, so the server doesn't know which virtual server it has to serve... therefore the result is always "http://myserver", even if I type "http://mysymfonyproject".
Here's an alternative:
- Delete the added lines in the HOSTS file.
- Open cmd.exe and type "nbtstat -a 192.168.0.10" (the server's IP)
Then, "http://myserver" works perfectly, but "http://mysymfonyproject" is not.
Inside the server all works perfectly, so it seems to be a problem serving inbound petitions from the network.
What am I doing wrong?
Also I have a project made with Symfony that I would like to access with a different name, for example "http://mysymfonyproject", but it doesn't work (it says the server was not found).
Here's my apache2.conf configuration:
- Code: Select all
NameVirtualHost *:80
#original apache location
<VirtualHost *:80>
ServerName myserver
DocumentRoot "/var/www"
</VirtualHost>
<VirtualHost *:80>
ServerName mysymfonyproject
DocumentRoot "/var/www/mysymfonyproject/web"
DirectoryIndex index.php
Alias /sf /usr/share/php/data/symfony/web/sf
<Directory "/usr/share/php/data/symfony/web/sf">
AllowOverride All
Allow from All
</Directory>
<Directory "/var/www/mysymfonyproject/web">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
But then I type this in my Windows XP machine:
- Code: Select all
http://myserver
And it doesn't find the server.
But if I modify the HOSTS file in my Windows XP machine adding this:
- Code: Select all
192.168.0.20 myserver mysymfonyproject
Then it works, BUT... both are pointing to the same IP, so the server doesn't know which virtual server it has to serve... therefore the result is always "http://myserver", even if I type "http://mysymfonyproject".
Here's an alternative:
- Delete the added lines in the HOSTS file.
- Open cmd.exe and type "nbtstat -a 192.168.0.10" (the server's IP)
Then, "http://myserver" works perfectly, but "http://mysymfonyproject" is not.
Inside the server all works perfectly, so it seems to be a problem serving inbound petitions from the network.
What am I doing wrong?