Skip to content

Instantly share code, notes, and snippets.

@leo-cheron
Last active August 29, 2015 14:13
Show Gist options
  • Save leo-cheron/cd6027a61ce2cf8a93d3 to your computer and use it in GitHub Desktop.
Save leo-cheron/cd6027a61ce2cf8a93d3 to your computer and use it in GitHub Desktop.
Apache2 virtual host macro template
<Macro VHost $name $domain>
<Directory /var/www/$name/*>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<VirtualHost *:80>
ServerName $domain
DocumentRoot /var/www/$name/www
php_admin_value open_basedir /var/www/$name/:/tmp/
ErrorLog ${APACHE_LOG_DIR}/$name.log
</VirtualHost>
<VirtualHost *:80>
ServerName $domain
ServerAlias *.$domain
VirtualDocumentRoot /var/www/$name/%1
php_admin_value open_basedir /var/www/$name/:/tmp/
#RewriteEngine On
#RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
#RewriteRule ^\/?(.*?)$ http://www.%{HTTP_HOST}/$1 [L,R=301]
</VirtualHost>
</Macro>
Use VHost folderName domain.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment