March 15, 2014

HTTP Configure a Virtual Host


Virtual hosts are good when you want to server multiple web sites from the same web server.


Install Apache Web Server.

Since I do not have a reliable DNS, we need to hardcode the host name in /etc/hosts on the client.

Initial Configuration

Configure Listen and ServerName, to be able to start the server clean without warnings.

Also verify that firewall (iptables) is configured or stop it 'service iptables stop'.

Now check our installation by restarting apache web server and open url '' from client machine. You should be able to see Apache Welcome Page. If not go back and fix.

Configure Name-Based Virtual Hosting

Now create two virtual host, one for the default host '' and one new ''.

Now create the new document root for ''.

Set file permissions.

Create test web page.

Set SELinux for our new virtual host.


Restart apache web server and test your new virtual host by accessing:

  1. (you should see default apache web server welcome page)
  2. (you should see your 'Hello World' page)

No comments: