Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Virtual Host in Apache 1.3.19 on RedHat 7.1 with Dynamic IP

Status
Not open for further replies.

kaioo

Technical User
Oct 2, 2001
13
US
I have a RH Linux 7.1 with Apache 1.3.19 machine, and this is connected to the internet using a DSL link. The DSL has a dynamic IP, and I've got a free DNS provider to assign me a name and 2 CNAMEs.
The linux machine is sitting between a small intranet and the internet, so I'm using it as router and also as a firewall. The /dev/eth0 interface is connected to the modem, and the /dev/eth1 interface is for the intranet.
What I need is to host 2 sites, one with the real name, and the other one using any of the two CNAMEs.
Do I lack of some piece of software or this can be done just editing the /etc/httpd/conf/httpd.conf file ?

I've tried almost everything I read on the net, but nothing seems to work completele well.

Can Anybody help ?
Thanks in advance.
 
Hi,

You should be able to do this with name based virtual hosting using something like this in httpd.conf:

NameVirtualHost *

<VirtualHost *>
ServerName DocumentRoot /var/</VirtualHost>

<VirtualHost *>
ServerName DocumentRoot /var/</VirtualHost>

The '*' is a wildcard that means to listen on any interface which gets round the dhcp issue.

Hope this helps
 
Thanks, I've tried that one, and I get to see both sites, but when trying to access another page that is not index.* in the server that is using the CNAME, I get the 404 page not found error.

Here is the full VirtualHost section for the domains:
<VirtualHost *>
ServerName realname.domain.com
DocumentRoot /var/<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory &quot;/var/Options Indexes Includes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.html index.htm index.shtml index.php index.php4 index.php3 index.cg
UseCanonicalName On
</VirtualHost>

<VirtualHost *>
ServerName secondsite.domain.com
DocumentRoot /var/<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory &quot;/var/Options Indexes Includes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.html index.htm index.shtml index.php index.php4 index.php3 index.cg
UseCanonicalName On
</VirtualHost>

Is there anything missing there ?

kaioo
 
Hi,

With name-based virtual hosts you should have UseCanonicalName off (With 'on' it uses ServerName instead of whats in the http header).

Regards
 
What a stoke of luck! I just added a chat server with its own sub-domain and was having a heck of a time getting my browser to find it. I thought I would come here and look at some old threads but looky what I found on the first page. I plumb forgot about turning off CanonicalNames. Thanx Ifincham.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top