0

I'm setting up my server to host 2 domains. In the VirtualHosts section I have it set up as they do on the Apache website. But line 280 or so asks for a DocumentRoot, well I have 2, what should I do here?

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by rch1231
0

You have to make two separate entries in the httpd.conf file like this:

NameVirtualHost *:80

<VirtualHost *:80>
        ServerAdmin webmaster@srvr4.txlinux.com
        DocumentRoot /var/www/html/txlinux.com
        ServerName srvr4.txlinux.com
        ServerAlias www.srvr4.txlinux.com
        ErrorLog logs/txlinux.com-error_log
        CustomLog logs/txlinux.com-access_log common
</VirtualHost>

<VirtualHost *:80>
        ServerAdmin webmaster@cherryoak.com
        DocumentRoot /var/www/html/cherryoak.com
        ServerName cherryoak.com
        ServerAlias www.cherryoak.com
        ErrorLog logs/cherryoak.com-error_log
        CustomLog logs/cherryoak.com-access_log common
</VirtualHost>

The NameVirtualHost *:80 above the first entry tell apache witch site is the default for the server if no URL is given just the IP address.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.