LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Name Based Virtual Host problem (https://www.linuxquestions.org/questions/linux-networking-3/name-based-virtual-host-problem-115046/)

helios007 11-11-2003 09:25 PM

Name Based Virtual Host problem
 
Hi,

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:

NameVirtualHost xxx.xx.xx.xxx


#
# Virtual hosts
#

# Virtual host newwebsite.com
<VirtualHost xxx.xx.xx.xxx>
DocumentRoot /var/www/html/sj
ServerName newwebsite.com
ServerAlias www.newwebsite.com
ServerSignature email
</VirtualHost>

# Virtual host originalwebsite.net
<VirtualHost xxx.xx.xx.xxx>
DocumentRoot /var/www/html/hpd
ServerName originalwebsite.net
ServerAlias www.originalwebsite.net
ServerSignature email
</VirtualHost>

Thanks for your help.:)

markus1982 11-12-2003 05:21 AM

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

helios007 11-12-2003 07:34 AM

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 -

helios007 11-13-2003 07:55 AM

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,
-Helios007

diginet1 11-29-2003 01:42 AM

I am having the exact same probvlem can somone pleeeeeeeeeease heeeelp??

bro 11-29-2003 11:14 AM

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 192.168.1.0 I lose my internet..)

route says:

Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 auto lo eth0
default 192.168.1.254 0.0.0.0 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:192.168.1.97 Bcast:255.255.255.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1356 Metric:1
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:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
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 192.168.1.97 came from..
my DSL modem is 192.168.1.254 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?

thanks,
John

eternalcrow 12-21-2003 03:41 PM

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:
111.222.333.444 www.domain1.com
111.222.333.444 www.domain2.com

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


All times are GMT -5. The time now is 05:14 PM.