Skip to content

Instantly share code, notes, and snippets.

@pasupulaphani
Last active December 29, 2015 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pasupulaphani/7742158 to your computer and use it in GitHub Desktop.
Save pasupulaphani/7742158 to your computer and use it in GitHub Desktop.
Configure Apache
### /etc/hosts ####
# Add to hosts. 192.168.0.13 is your server ip (ifconfig)
192.168.0.13 www.site2.com site2.com
192.168.0.13 www.site3.com site3.com
### Make sure that NameVirtualHost is set properly. (check ports.conf in exists)
# This is the name of the main Virtual Host, your main web-server name.
# This could also be replaced by the server's IP address or by the * character.
# But if you have multiple sites with names then * will conflict.
NameVirtualHost *:80
# Listen to all requests from port 80 and 443(https)
Listen 80
Listen 443
# Create individual hosts in sites-available
<VirtualHost *:80>
# Basic setup
ServerAdmin webmaster@site2.com
ServerName site2.com
ServerAlias www.site2.com
DocumentRoot /home/phani/mysites/site2
# HTML documents, with indexing.
<Directory /home/phani/mysites/site2>
Options +Includes
</Directory>
# CGI Handling
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Location /usr/lib/cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /home/phani/mysites/site2/error.log
CustomLog /home/phani/mysites/site2/logs/access.log combined
</VirtualHost>
<VirtualHost *:80>
# Very basic setup
ServerAdmin webmaster@site3.com
ServerName site3.com
ServerAlias www.site3.com
DocumentRoot /home/phani/mysites/site3
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment