Skip to content

Instantly share code, notes, and snippets.

@derekaug
Last active June 27, 2017 16:08
Show Gist options
  • Save derekaug/bb5248a9e02d2dfe3434a8d779c8b221 to your computer and use it in GitHub Desktop.
Save derekaug/bb5248a9e02d2dfe3434a8d779c8b221 to your computer and use it in GitHub Desktop.
Base template for Apache Virtual Hosts
# Listening ports.
Listen {PORT}
# Set up permissions for VirtualHosts in ~/Sites
<Directory "/Users/{USERNAME}/Sites">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
# Tell Apache to use PHP-FPM for PHP files
# Probably not the "right" place for this, but it's the easiest
<FilesMatch "\.php$">
SetHandler "proxy:fcgi://127.0.0.1:9000/"
</FilesMatch>
# Public
<VirtualHost *:8005>
ServerName {DOMAIN}
DocumentRoot /Users/{USERNAME}/Sites/{DOMAIN}
CustomLog "/Users/{USERNAME}/Sites/logs/{DOMAIN}-access_log" combinedmassvhost
ErrorLog "/Users/{USERNAME}/Sites/logs/{DOMAIN}-error_log"
</VirtualHost>
# Auto VirtualHosts for *.dev with root in public
<VirtualHost *:8005>
ServerName dev
ServerAlias *.dev
CustomLog "/Users/{USERNAME}/Sites/logs/dev-access_log" combinedmassvhost
ErrorLog "/Users/{USERNAME}/Sites/logs/dev-error_log"
VirtualDocumentRoot /Users/{USERNAME}/Sites/%-2+/public
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment