Pointing a Domain to a Directory on a UNIX System

I am running a UNIX server on 1and1. I have multiple domains and I want to point each domain to their own folder, essentially having each domain point to their own site.

I have root access and need to point multiple domains to different destination folder. The following instructions will demonstrate how to point your domain to a specific folder directory in a UNIX operating system. .

Note: Before continuing, it is assumed that the Name Servers settings are correct.

Steps:

  1. Go to the following path /etc/apache2
  2. Edit the file named apache2.conf
  3. Copy and Paste the following and replace the domain and path to match your settings:

    Note: NameVirtualHost *:80 is required only once at the beginning.

    NameVirtualHost *:80

    <VirtualHost *:80>
    ServerName www.juanitoibarra.com
    ServerAlias juanitoibarra.com *.juanitoibarra.com
    DocumentRoot /var/www/html/juanibarra
    </VirtualHost>

    For each additional domain, you would do the same by adding another entry as shown below:

    <VirtualHost *:80>
    ServerName www.tacobytes.com
    ServerAlias tacobytes.com *.tacobytes.com
    DocumentRoot /var/www/html/modules
    </VirtualHost>

  4. When complete, restart the Apache server.

This information was obtained from Apache’s Website.