How-to Set-Up a Multiple IP Based Apache Virtual-Hosts Loopback for localhost on Mac OS X

May 13th, 2013 by Regaz

The Easy Guide Shows You Step-by-Step How-to Set-Up an IP Based Virtual Hosts Loopback for Apache Web Server on Mac OS X Desktop.

The Content and Details are Essentials and Give Focus only to Instructions and Commands.

Apple on Cloud
  1. Open Terminal Window
    (Press “Enter” to Execute Commands)
  2. Make a Loopback Alias
    sudo su

    If Got “User is Not in Sudoers file” then Look: Solution

    ifconfig lo0 alias
  3. Inserts New IP on /etc/hosts
    nano /etc/hosts

    Modify Line Containing localhost for Example Like:, localhost

    Ctrl+x to Save & Exit :)

  4. Enabling Virtual Host
    1. Enable Virtual-Host Conf File
      nano /conf/httpd.conf

      Check that the Line Below Is Not Commented Out…

      Include /extra/httpd-vhosts.conf

      (By Default apache2 Dir is Inside /private/etc/)

    2. Make the New Host Directory
      mkdir /Library/WebServer/Documents2
      echo 'Working!' > /Library/WebServer/Documents2/index.html
    3. Set-Up IP Based Virtual-Hosts
      nano /extra/httpd-vhosts.conf

      Inserts Something Like:

      DocumentRoot “/Library/WebServer/Documents”
      ServerName localhost.1
      ErrorLog “/private/var/log/apache2/”

      DocumentRoot “/Library/WebServer/Documents2”
      ServerName localhost.2
      ErrorLog “/private/var/log/apache2/”

    4. Give Permissions to New Host Root Directory
      nano /conf/httpd.conf

      Inserts Below the Existing Root Directory:

      Options Indexes FollowSymLinks MultiViews
      AllowOverride None
      Order allow,deny
      Allow from all

  5. Restart Apache
  6. Next Access New Virtual Host on Browser
    It Should Be Just Successfully Working! :)
  7. How-to Install Apache Cassandra NoSQL Database for Mac OS X:

    Cassandra Installation Mac

Tags: , , , , , , , , ,