Last active
November 1, 2015 19:51
-
-
Save sndwch/cb1033dc032eb0fceda2 to your computer and use it in GitHub Desktop.
Apache/PHP setup for per-developer Environments.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LogLevel debug | |
<VirtualHost *:80> | |
ServerAdmin [email protected] | |
ServerAlias dev.yourserver.com *.dev.yourserver.com | |
ServerName dev.yourserver.com | |
RewriteEngine on | |
RewriteCond %\{HTTP_HOST\} !^www.* [NC] | |
RewriteCond %\{HTTP_HOST\} ^dev\\.yourserver\\.com(.*) | |
RewriteRule ^(.*) /var/www/dev/public_html/$1 [L] | |
RewriteCond %\{HTTP_HOST\} !^www.* [NC] | |
RewriteCond %\{HTTP_HOST\} ^([^\\.]+)\\.dev\\.yourserver\\.com | |
RewriteRule ^(.*)$ - [env=host_uname:%1] [N,NS] | |
RewriteCond %\{HTTP_HOST\} ^([^\\.]+)\\.dev\\.yourserver\\.com(.*) | |
RewriteRule ^(.*) /var/www/dev/%\{ENV:host_uname\}/public_html/$1 [L] | |
DocumentRoot /var/www/dev/public_html | |
<Directory /> | |
Options FollowSymLinks | |
AllowOverride All | |
</Directory> | |
<Directory /var/www/dev/public_html> | |
Options Indexes FollowSymLinks MultiViews | |
AllowOverride All | |
Order allow,deny | |
allow from all | |
</Directory> | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This allows you to have developername.dev.yourserver.com map to /var/www/dev/developername/public_html. Much easier to manage than using ports, etc when using a shared dev environment.