Skip to content

Instantly share code, notes, and snippets.

@ChengLong
Created October 27, 2014 17:17
Show Gist options
  • Save ChengLong/2565e917f131abfe54c7 to your computer and use it in GitHub Desktop.
Save ChengLong/2565e917f131abfe54c7 to your computer and use it in GitHub Desktop.
Add Virtual Host in Apache
  1. Create a virtual host file at /etc/apache2/sites-available/yoursite.conf, e.g.
<VirtualHost *:80>
  ServerName yoursite.com
  DocumentRoot /somewhere/public
  
  <Directory /somewhere/public>
     # This relaxes Apache security settings.
     AllowOverride all
     # MultiViews must be turned off.
     Options -MultiViews
     # Uncomment this if you're on Apache >= 2.4:
     Require all granted
  </Directory>
</VirtualHost>
  1. Enable it sudo a2ensite yoursite.conf
  2. Activate it sudo service apache2 reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment