Apache Virtual Hosts

This is the easiest thing in the world to do. That said, it's one of the most commonly asked questions on Linux web forums.

In /etc/httpd/conf/httpd.conf scroll to the bottom and find the line that says

#NameVirtualHost *:80

Un-hash it, and then add your virtual host(s) below it. Multiple hosts? Create a new entry for each virtual host.

<VirtualHost *:80>
    ServerName linux-101.org
    ServerAlias *.linux-101.org
    DocumentRoot /data/web/linux-101.org/public_html
    ServerAdmin hostmaster@nospam.uplinkzero.com
 
    ErrorLog logs/linux-101.org_error.log
    CustomLog logs/linux-101.org_access.log combined
 
    <Directory "/var/www/linux-101/public_html">
        Options Indexes
        IndexOptions FancyIndexing
        Order allow,deny
        Allow from ALL
    </Directory>
</VirtualHost>

People who are using SELinux policies should check the permissions on their document root. The default will work.

Burtronix Banner W3C Banner