LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-02-2004, 08:26 PM   #1
di11rod
Member
 
Registered: Jan 2004
Location: Austin, TEXAS
Distribution: CentOS 6.5
Posts: 207

Rep: Reputation: 32
Apache redirecting to IP address


Hey, I've been searching all over for virtual hosting-related posts, but can't find the solution to this bugger....

I have set up a virtual host in my vhosts/Vhosts.conf file. Every request for the virtual host gets redirected in the browser to the document root with the IP address replacing the hostname typed into the browser.

as in:

http://www.norwoodtower.com
becomes
http://216.165.210.197/

and the page served is from the root directory.

here are (what I think are) the relevant pieces of info:

virtual host file:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName 216-165-210-197.crescentb.com
DocumentRoot /var/www/html/
HostnameLookups on
Options +Includes
AddHandler server-parsed .html
</VirtualHost>

<VirtualHost *:80>
ServerName www.norwoodtower.com
ServerAlias norwood.com *.norwood.com
DocumentRoot /var/www/html/nt
</VirtualHost>

In my commonhttpd.conf--

UseCanonicalName On

In httpd2.conf---
ServerName boombox
DocumentRoot /var/www/html

In my /etc/hosts file---
127.0.0.1 localhost
192.168.0.50 boombox
192.168.0.50 www.norwoodtower.com
192.168.0.50 norwoodtower.com
192.168.0.50 216-165-210-197.crescentb.com


I know that the permissions are all ok because when I type this URL-
http://216.165.210.197/nt/

the correct page is delivered that should be delivered for the virtual host.

Any ideas? Oh yeah. Mandrake 9.2 on a Celeron 3 box.

Appreciatively,

di11rod
 
Old 06-03-2004, 03:18 AM   #2
SBing
Member
 
Registered: Mar 2004
Posts: 519

Rep: Reputation: 35
To be honest, you're not going to get help with Apache in this forum, because most people don't really do this kind of thing.

VirtualHosts are a pain and I can't see anything wrong in your setup. I think it's more a case of fiddling until it works, thats how I did it, just keep editing and recycling apache (you are doing that aren't you? "apachectl restart").

Whats the output of httpd -S ?

Steve
 
Old 06-03-2004, 05:27 AM   #3
kbcnetau
Member
 
Registered: Dec 2003
Location: South Australia (ex-Devon, UK)
Distribution: SuSE, Slackware, Fedora, Debian, Knoppix
Posts: 141

Rep: Reputation: 15
Um, does this mean that you have virtual host and also have single host configuration? If so, this could be a problem.

Do you have an instruction to include the virtual hosts file in your mail configuration file (httpd.conf or whatever)?
 
Old 06-03-2004, 07:04 AM   #4
SBing
Member
 
Registered: Mar 2004
Posts: 519

Rep: Reputation: 35
Quote:
Originally posted by kbcnetau
Um, does this mean that you have virtual host and also have single host configuration? If so, this could be a problem.
I think you have to have a "Main Server Configuration" (Section 2 in httpd.conf" as well as your VirtualHosts configuration (Section 3). However, I don't see this as a problem:

If a client connects directly to your webserver by IP (not by hostname) then they connect to the Main Server Configuration, which has a index.html file that says

"Hosted on this machine are: www.foo.tld; www.foo2.tld etc...."

The rest of the virtualhosts are name based virtualhosts etc... (i.e. www.foo.tld; www.foo2.tld)

Quote:
Originally posted by kbcnetau
Do you have an instruction to include the virtual hosts file in your mail configuration file (httpd.conf or whatever)?
Sorry I don't, but google should help you there :)

Steve
 
Old 06-03-2004, 07:18 AM   #5
kbcnetau
Member
 
Registered: Dec 2003
Location: South Australia (ex-Devon, UK)
Distribution: SuSE, Slackware, Fedora, Debian, Knoppix
Posts: 141

Rep: Reputation: 15
"Do you have an instruction to include the virtual hosts file in your mail configuration file (httpd.conf or whatever)?"

What I meant by that was this:

The virtual hosts are not in httpd.conf, but in an external file. I used to use separate files and recall having had to have an include statement in the main httpd.conf so that this file gets read.
 
Old 06-03-2004, 02:26 PM   #6
SBing
Member
 
Registered: Mar 2004
Posts: 519

Rep: Reputation: 35
Oh -

I just use httpd.conf for virtualhosts, I didn't know there was another way :)

Steve
 
Old 06-03-2004, 07:18 PM   #7
kbcnetau
Member
 
Registered: Dec 2003
Location: South Australia (ex-Devon, UK)
Distribution: SuSE, Slackware, Fedora, Debian, Knoppix
Posts: 141

Rep: Reputation: 15
"I just use httpd.conf for virtualhosts, I didn't know there was another way "

...and I think that you are better off like that! I did away with external files due to the sheer confusion and difficulty of maintenance.

My advice to di11rod, if still having problems, is to find the line that starts with "include ..." and contains the reference to the external file and remove it from httpd.conf. Then take the contents of the virtual hosts file and just pop it at the end of httpd.conf. This will take some sources of confusion out of the equation.
 
  


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
IP address not resloved in Apache raghavendra Linux - Networking 5 03-20-2005 11:07 AM
Problem Redirecting in Apache kaplan71 Linux - Software 0 09-09-2004 03:52 PM
apache redirecting mardanian Linux - Networking 1 04-14-2004 07:17 AM
Redirecting non-user mail to a local address? Trent Hatred Red Hat 2 11-19-2003 11:59 AM
apache address problem?? automicro Linux - Software 1 08-14-2003 01:43 PM


All times are GMT -5. The time now is 03:17 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration