Last active
August 29, 2015 14:13
-
-
Save Maff-/7bb088ccff6b0b7dc681 to your computer and use it in GitHub Desktop.
Dynamic Apache projects vhost
This file contains hidden or 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
<VirtualHost *:80> | |
#ServerName www.example.com | |
ServerAdmin webmaster@localhost | |
DocumentRoot /var/www/projects | |
<Directory /var/www/projects> | |
# enable the .htaccess rewrites | |
AllowOverride All | |
Require all granted | |
</Directory> | |
#LogLevel info ssl:warn | |
ErrorLog ${APACHE_LOG_DIR}/error-projects.log | |
CustomLog ${APACHE_LOG_DIR}/access-projects.log host_combined | |
#Include conf-available/serve-cgi-bin.conf | |
RewriteEngine On | |
RewriteMap lowercase int:tolower | |
RewriteCond %{REQUEST_URI} ^/icons/ | |
RewriteRule .? - [L] | |
RewriteCond ${lowercase:%{HTTP_HOST}} ^([^.]+)\.web\.ruud\.vm$ | |
RewriteRule ^/(.*)$ /var/www/projects/%1/web/$1 | |
RewriteCond ${lowercase:%{HTTP_HOST}} ^([^.]+)\.ruud\.vm$ | |
RewriteRule ^/(.*)$ /var/www/projects/%1/$1 | |
</VirtualHost> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment