LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-06-2007, 04:36 AM   #1
hapytran
LQ Newbie
 
Registered: Jan 2006
Posts: 9

Rep: Reputation: 0
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
 
Old 12-06-2007, 07:58 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 256Reputation: 256Reputation: 256
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.
 
Old 12-06-2007, 07:24 PM   #3
hapytran
LQ Newbie
 
Registered: Jan 2006
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by trickykid View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Subdomains where ServerName is an ip address garnetlion Linux - Server 2 12-06-2007 12:25 PM
Firefox Configuration via url address box b18b Linux - Software 3 02-06-2007 05:36 PM
force user ID to IP address? Fillys6 Linux - General 3 02-07-2006 10:16 AM
how to force ip address/host name pair sichen Linux - Networking 4 08-12-2004 10:50 AM
anyone can decode this URL address? sirpelidor Linux - Software 8 02-21-2004 02:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration