Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 11-11-2003, 10:25 PM   #1
LQ Newbie
Registered: Aug 2003
Posts: 20

Rep: Reputation: 0
Name Based Virtual Host problem


I'm using Apache2 on RH9. I've hosted a single web site with a singe IP with no problems for the past month.

This week I've attempted to host a second site using the same IP - using the name based virtual server options, but I'm not having any luck. I keep getting the Apache Test page - when I think that I have it configured correctly. With some tweaking, I can get the original page with both web site addresses (which I don't want - I want to host 2 separate sites, with separate addresses).

I've set the folder's permissions to 755.

I'm sure that it is something simple that I've overlooked, I've been scouring the web and books, but I can't seem to pin down what I'm missing (or don't understand).

Here's the only things that I've changed on the httpd.conf since adding the new site:


# Virtual hosts

# Virtual host
DocumentRoot /var/www/html/sj
ServerSignature email

# Virtual host
DocumentRoot /var/www/html/hpd
ServerSignature email

Thanks for your help.
Old 11-12-2003, 06:21 AM   #2
Senior Member
Registered: Aug 2002
Location: Stuttgart (Germany)
Distribution: Debian/GNU Linux
Posts: 1,467

Rep: Reputation: 46
Are you attempting to access the website by IP or by hostname? When you access it by IP address as URL you will always get to the website which is the first one in your virtualhost config for that particular ip.

If you access it by name you need to support HTTP/1.1
Old 11-12-2003, 08:34 AM   #3
LQ Newbie
Registered: Aug 2003
Posts: 20

Original Poster
Rep: Reputation: 0
I'm attempting to access it by hostname and support HTTP/1.1.

Also just to note, after adjusting the "Main" Document root to /var/www/html/sj, I was able to access the "newwebsite" with no problem. So that means that the DNS is working and I can access each web site individually(by tweaking the "Main" Document Root.

But when I return the "Main" Document Root to /var/www/html. I get the Apache test page again. Why is the Virtual hosting not kicking in?

Thanks -
Old 11-13-2003, 08:55 AM   #4
LQ Newbie
Registered: Aug 2003
Posts: 20

Original Poster
Rep: Reputation: 0
Ok, after more experimentation, I'm still basically in the same place.

Whenever I type in either one of my host name url's, I keep getting pointed to the default web page stored in the Main Document Root. Any ideas? It seems like name based virtual hosting isn't turned on for some reason. Do I need to do something else other than:

1. Uncomment NameVirtualHost and give it an IP addy
2. Set up <Virtual Hosts> with an IP, server name and document root value for each web site that I want to host


One interesting point I noted when experimenting, is that when I gave NameVirualHost an "*" value , I received a 530 error when attempting to access my pages. But when I gave a numeric value, it seemed to work, but directed both urls to the same folder in the Main Document Root.

Any ideas?

Thanks for your help,
Old 11-29-2003, 02:42 AM   #5
LQ Newbie
Registered: Nov 2003
Posts: 4

Rep: Reputation: 0
I am having the exact same probvlem can somone pleeeeeeeeeease heeeelp??
Old 11-29-2003, 12:14 PM   #6
LQ Newbie
Registered: Aug 2003
Location: Florida
Distribution: Debian Sarge
Posts: 10

Rep: Reputation: 0
me too

I'm having similar problems (and I posted in the debian list, but no reply)
I've been googling my butt off, and searching through the stuff here on LQ
trying to understand man ifconfig and man route, but no success yet..

I used to run 10 or so local ip-based apache virtual servers under RH7.1
(*.vnet on 192.168.1.n)
and it continued to work when I let Bellsouth set me up with ADSL (westell router).
At the time my vpn wouldn't work..

I just set up Debian Sarge via the Knoppix CD and it went great.
Got my VPN working too.. (a Cisco vpn package from my school)

Except I can't get my local domain names or ip #s to respond.
my domains are set up in apache and /etc/hosts

/etc/networking/interfaces contains

auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp

(and if I try to set up a static ip for I lose my internet..)

route says:

Destination Gateway Genmask Flags Metric Ref Use Iface * U 0 0 auto lo eth0
default UG 0 0 0 eth0

If i try to add something to route, I always lose my net connection there too %-(

ifconfig says:
eth0 Link encap:Ethernet HWaddr 00:A0:CC:33:CF:C5
inet addr: Bcast: Mask:
RX packets:406182 errors:0 dropped:0 overruns:0 frame:0
TX packets:239874 errors:1 dropped:0 overruns:0 carrier:2
collisions:0 txqueuelen:100
RX bytes:568527931 (542.1 MiB) TX bytes:39670803 (37.8 MiB)
Interrupt:5 Base address:0xd800

lo Link encap:Local Loopback
inet addr: Mask:
RX packets:146285 errors:0 dropped:0 overruns:0 frame:0
TX packets:146285 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7618363 (7.2 MiB) TX bytes:7618363 (7.2 MiB)

Apache says "domain not found" for my main domain and all the virtual hosts
respond "connection refused"

I don't know where that came from..
my DSL modem is but I don't see that anywhere..

ping maps names to IP#s (via /etc/hosts)
but host says they don't exist..

I guess the methods for setting things up vary a lot from one flavor of linux to the next,
but can somebody help us networking-newbies out?

Old 12-21-2003, 04:41 PM   #7
LQ Newbie
Registered: Jul 2003
Location: Halifax
Distribution: Mandrake 9.2
Posts: 13

Rep: Reputation: 0
Quick help folks: I had the same problem, I have the vhosts.conf file set up properly with the same port used for all virtual hosts. You either need to set up the DNS or place the domains in the "hosts" file in /etc.

I am only hosting two websites and the "hosts" file has the following:

just fill the IP with your internet ip and you domains as appropriate.


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
How to configure the virtual host based name? gz_xmg Linux - Networking 0 12-28-2004 02:12 AM
Virtual Host Problem tictocdoc Linux - Networking 7 05-12-2004 10:08 PM
IP based virtual hosts problem adm1329 Linux - Networking 4 03-11-2004 11:40 AM
virtual host problem Michele Linux - Newbie 5 08-18-2003 12:05 PM
Virtual Host Problem using Apache ataber Linux - Newbie 2 01-27-2003 01:32 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:44 AM.

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