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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Virtual Host problems

Status
Not open for further replies.

frozenpeas

Technical User
Sep 13, 2001
893
0
0
CA
I am running Red Hat Linux 7.0. I want to set it up with two domains: the primary server (domain1.com) and a virtual host (domain2.com). I also want to setup another virtual host under domain2.com (mail.domain2.com).

I have a few problems. As soon as I set up ONE virtual host, ALL go to it. The primary server no longer handles any requests.

If I set up more than one virtual host, NO function anywhere: I get a cannot find server error.

The only place I have been configuring any of this is in the httpd.conf file. What am I doing wrong?

Thanks.
 
Are you configuring address-based virtual hosts(each host has a unique IP) or named-based virtual hosts(all hosts share the same IP)?

Either way, you need to insure each domain is properly configured in BIND. If you follow traditional naming conventions, that would include the configuration file /etc/named.conf and the zone data files /var/named/named.domain1.com and /var/named/named.domain2.com. (see for synopsis).

Be sure the "mail" subdomain of domain2.com has a CNAME entry in /var/named/named.domain2.com.

I'd suggest you keep your domain-name modifications within the scope of BIND. Control permissions and content through Apache.
 
Thanks for your response, rwharvey.

I am configuring name-based virtual hosts.

I'll try following your advice. Thanks very much.
 
Hm. I don't have BIND. Is that a DNS thing? All I have is my server. Please don't tell me I have to have my own DNS machines.

Is this the only way around the problem?
 
just create 2 virtualhost containers:

<VirtualHost 192.168.1.100>
ServerName domain.com
DocumentRoot /httpd/html/domain
</VirtualHost>
<VirtualHost 192.168.1.101>
ServerName mail.domain.com
DocumentRoot /httpd/html/mail-dom
</VirtualHost>

If you are behind a firewall such as a dsl router, check out my faq on virtualhosts behind firewalls for more information.

Hope this helps !!!


Rninja
smlogo.gif

 
Assuming your DNS is correctly setup...
I think this will help you dude!

Each VirtaulHost needs it's own record.
domain.com and mail.domain.com should have their own record in httpd.conf


NOTE: CAPS REFLECT VARIABLES THAT YOU NEED TO FILL IN

[SUBDOMAIN] most likely reflects a [CNAME] such as [www.domain.com] or [mail.domain.com]

Add this to httpd.conf:

NameVirtualHost SERVER_IP
<VirtualHost SERVER_IP>
ServerAdmin EMAIL_ADDRESS
DocumentRoot PATH_TO_HOMEPAGE
ServerName DOMAIN.COM
ServerAlias SUBDOMAIN.DOMAIN.COM
</VirtualHost>
<VirtualHost SERVER_IP>
ServerAdmin EMAIL_ADDRESS2
DocumentRoot PATH_TO_HOMEPAGE2
ServerAlias SUBDOMAIN2.DOMAIN.COM
</VirtualHost>
<VirtualHost SERVER_IP>
ServerAdmin EMAIL_ADDRESS3
DocumentRoot PATH_TO_HOMEPAGE3
ServerAlias SUBDOMAIN3.DOMAIN.COM
</VirtualHost>.

SUBDOMAIN2 might be MAIL
SUBDOMAIN3 might be DNS (Of course, who'd run their DNS on the same server as their regular web server?) hehe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top