Forum Moderators: phranque
I have a strange problem, I think it will be quite easy for you to solve, but I really tried many things with it and I just couldn't figure out the solution.
first take a look at these 2 files
here's /etc/hosts (I don't have a DNS)
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
127.0.0.1 abbas.jackandmido.com abbas
127.0.0.1 happy.jackandmido.com happy
here's my /etc/httpd/conf/httpd.conf
<VirtualHost *>
ServerAdmin webmaster@mango.com
DocumentRoot /var/www/marsguy
ServerName abbas.jackandmido.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
<VirtualHost *>
ServerAdmin webmaster@mango.com
DocumentRoot /var/www/html/mango
ServerName happy.jackandmido.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
these domains are just for test, they don't really exist.
the problem is: when I type "abbas.jackandmido.com" or "happy.jackandmido.com" I get the same page which is located in "/var/www/marsguy" (the first in order)!
please help me!
thanks in advance
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@mango.com
DocumentRoot /var/www/marsguy
ServerName abbas.jackandmido.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
<VirtualHost *>
ServerAdmin webmaster@mango.com
DocumentRoot /var/www/html/mango
ServerName happy.jackandmido.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
Cheers
Thank you Birdman for helping me :)
I found the solution, the solution is to assign your webserver's IP address to the NameVirtualHost directive. like so:
this is the new httpd.conf and it is working perfectly.
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot /var/www/html/marsguy
ServerName abbas.jackandmido.com
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot /var/www/html/mango
ServerName happy.jackandmido.com
</VirtualHost>
I had (*) assigned to the NameVirtualHost directive like you told me to do before but it didn't work! I don't know why?
Thanks again for helping me!