Skip to content

Instantly share code, notes, and snippets.

@johnrc
Last active August 29, 2015 14:15
Show Gist options
  • Save johnrc/956d3ba78d4539caf3a3 to your computer and use it in GitHub Desktop.
Save johnrc/956d3ba78d4539caf3a3 to your computer and use it in GitHub Desktop.
Basic Apache virtual host configuration
# http://www.rackspace.com/knowledge_center/article/how-to-serve-multiple-domains-using-virtual-hosts
# Uncomment this line from /etc/httpd/conf/httpd.conf
NameVirtualHost *:80
# Create multiple files for each vhost or put them all in one
# They just need to be named with *.conf to be picked up
<VirtualHost *:80>
ServerName example.org
ServerAlias *.example.org
ServerAdmin webmaster@example.org
ErrorLog /var/log/httpd/example.err
CustomLog /var/log/httpd/example.log combined
DocumentRoot /var/www/html/mysite2
<Directory "/var/www/html/mysite2">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName example.com
ServerAlias *.example.com
ServerAdmin webmaster@example.com
ErrorLog /var/log/httpd/example.err
CustomLog /var/log/httpd/example.log combined
DocumentRoot /var/www/html/piwik
<Directory "/var/www/html/piwik">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment