LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Force using URL (ServerName) instead of IP address (https://www.linuxquestions.org/questions/linux-server-73/force-using-url-servername-instead-of-ip-address-604883/)

hapytran 12-06-2007 04:36 AM

Force using URL (ServerName) instead of IP address
 
Hi,

I was successful to set up virtual host on my Redhat Enterprise Linux 4 base on NameVirtualHost. I added two records in httpd.conf file and disable default virtual host like below:

# Virtual host Default Virtual Host
#<VirtualHost *>
# ServerSignature email
# DirectoryIndex index.php index.html index.htm index.shtml
# LogLevel warn
# HostNameLookups off
#</VirtualHost>

NameVirtualHost 70.182.xxx

<VirtualHost 70.182.xxx>
ServerName www.abc.com
ServerAlias abc.com
DocumentRoot /var/www/html/abc
DirectoryIndex index.php index.html index.htm index.shtml
</VirtualHost>

<VirtualHost 70.182.xxx>
ServerName www.bcd.com
ServerAlias bcd.com
DocumentRoot /var/www/html/bcd
DirectoryIndex index.php index.html index.htm index.shtml
</VirtualHost>

When user type www.abc.com, the first virtual host is called and the second is called when user type www.bcd.com. But when user type 70.182.xxx, the first virtual host is called. Why? How can I disable that and force user using URL instead of IP address?

Thanks

trickykid 12-06-2007 07:58 AM

Do these actually have two different IP's or use the same IP? In order to use two IP's for two virtual hosts, you need two different IP's or using the IP of the server will result in using the first virtual host or main configured Domain.

hapytran 12-06-2007 07:24 PM

Quote:

Originally Posted by trickykid (Post 2982040)
Do these actually have two different IP's or use the same IP? In order to use two IP's for two virtual hosts, you need two different IP's or using the IP of the server will result in using the first virtual host or main configured Domain.

The same IP address


All times are GMT -5. The time now is 09:28 PM.