Manually Configuring Virtual Subhosts

In order to manually configure a Virtual Subhost, connect to your Virtual Private Server via SSH, su to root, and do the following:

  1. Run either vadduser to create the primary user's account, or run vedituser to grant the user web and FTP permissions. This will create a www directory under their username. The www directory will contain both a cgi-bin directory and a logs directory.

  2. For each Virtual Subhost you configure on your Virtual Private Server you will need to create a new directory for the Virtual Subhost domain files in the specified User's www directory.

    # mkdir -p ~/home/USERNAME/www/SUBHOST-DOMAIN.NAME
  3. Open up your web server configuration file (/www/conf/httpd.conf) and add the following lines in the <VirtualHost> section of the file to ensure compatibility with Microsoft FrontPage. The <VirtualHost> section is found at the bottom of the file.

    <VirtualHost SUBHOST-DOMAIN.NAME www.SUBHOST-DOMAIN.NAME:80>
        User           USERNAME
        Group          USERNAME
        ServerName     SUBHOST-DOMAIN.NAME
        ServerAdmin    webmaster@SUBHOST-DOMAIN.NAME
        DocumentRoot   /home/USERNAME/www/SUBHOST-DOMAIN.NAME
        ScriptAlias    /cgi-bin/ "/home/USERNAME/www/cgi-bin/"
        <Directory /home/USERNAME/www/cgi-bin>
          AllowOverride None
          Options ExecCGI
          Order allow,deny
          Allow from all
        </Directory>
        CustomLog      /home/USERNAME/www/logs/access_log combined
        ErrorLog       /home/USERNAME/www/logs/error_log
    </VirtualHost>

    NOTE: If you want this Virtual Host SSL enabled, you will need to add the following entry as well:

    <VirtualHost SUBHOST-DOMAIN.NAME www.SUBHOST-DOMAIN.NAME:443>
        SSLEnable
        User           USERNAME
        Group          USERNAME
        ServerName     SUBHOST-DOMAIN.NAME
        ServerAdmin    webmaster@SUBHOST-DOMAIN.NAME
        DocumentRoot   /home/USERNAME/www/SUBHOST-DOMAIN.NAME
        ScriptAlias    /cgi-bin/ "/home/USERNAME/www/cgi-bin/"
        <Directory /home/USERNAME/www/cgi-bin>
          AllowOverride None
          Options ExecCGI
          Order allow,deny
          Allow from all
        </Directory>
        CustomLog      /home/USERNAME/www/logs/access_log combined
        ErrorLog       /home/USERNAME/www/logs/error_log
    </VirtualHost>

    You must substitute the Virtual Subhost domain name in place of SUBHOST-DOMAIN.NAME above. Also be sure that the first domain name you list in the <VirtualHost...> directive above matches the domain name you specify as the ServerName (again, to ensure compatibility with Microsoft FrontPage).

    NOTE: If the specified User will be responsible for more than one Virtual Host, you may want to create separate virtual host logs, rather than combined logs.

    CustomLog      /home/USERNAME/www/logs/SUBHOST-DOMAIN.NAME-access_log combined
    ErrorLog       /home/USERNAME/www/logs/SUBHOST-DOMAIN.NAME-error_log
  4. For more details about Virtual Subhosts and e-mail, see the following.