Skip to content

Instantly share code, notes, and snippets.

@aamnah
Last active May 30, 2018 16:20
Show Gist options
  • Select an option

  • Save aamnah/4ceb275b6e095894bd8d to your computer and use it in GitHub Desktop.

Select an option

Save aamnah/4ceb275b6e095894bd8d to your computer and use it in GitHub Desktop.
Vhost sample file for Apache2
# domain: domain.com
# public: /var/www/domain.com/public_html/
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin [email protected]
ServerName www.domain.com
ServerAlias domain.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/domain.com/public_html
# Allow .htaccess and Rewrites
<Directory /var/www/domain.com/public_html>
Options FollowSymLinks
AllowOverride All
</Directory>
# Log file locations
LogLevel warn
ErrorLog /var/www/domain.com/log/error.log
CustomLog /var/www/domain.com/log/access.log combined
</VirtualHost>
@aamnah
Copy link
Copy Markdown
Author

aamnah commented Apr 3, 2015

Create the conf file in sites-available. Once created, run sudo a2ensite domain.com.conf to enable the site in sites-enabled.

@aamnah
Copy link
Copy Markdown
Author

aamnah commented Apr 3, 2015

The other way of enabling the site is by creating a symlink

sudo ln -s /etc/apache2/sites-available/domain.com.conf /etc/apache2/sites-enabled/domain.com.conf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment