Skip to content

Instantly share code, notes, and snippets.

@ianjamieson
Last active March 13, 2017 23:31
Show Gist options
  • Save ianjamieson/926ca27f10a4e38c47040225826f28a6 to your computer and use it in GitHub Desktop.
Save ianjamieson/926ca27f10a4e38c47040225826f28a6 to your computer and use it in GitHub Desktop.
Simple Virtual Hosts Boilerplate, primarily used for WordPress installs
# Start the Virtual Host block, apply for all traffic on port 80
<VirtualHost *:80>
# The document root is where the project files will be saved on your computer, ensure that Apache can read from this directory
DocumentRoot "/path/to/doc/root"
# The server name is what you type in your browser to access the site, this will also need to be set up in your hosts file
ServerName yoursitename.dev
# If you are interested in tailing error logs, then you can specify a file to output these logs to
ErrorLog "/private/var/log/apache2/yoursitename.dev-error_log"
# As above, but this is for all requests, not errors
CustomLog "/private/var/log/apache2/yoursitename.dev-access_log" common
# We now specify a directory block, configurations in here will only apply to this directory, which should be set to the document root.
<Directory /path/to/doc/root>
# Ensure that any symlinks are followed, this is like creating a shortcut
Options Indexes FollowSymLinks
# If there is an .htaccess file in the doc root folder, then AllowOverride will ensure that the configurations are not ignored
Require local
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment