Skip to content

Instantly share code, notes, and snippets.

@andrechavesg
Created May 4, 2019 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrechavesg/d87ae7aaf0835d5325b7a5dea56bab98 to your computer and use it in GitHub Desktop.
Save andrechavesg/d87ae7aaf0835d5325b7a5dea56bab98 to your computer and use it in GitHub Desktop.
<VirtualHost *:80>
Define server_name local
Define basedocroot /home/wwwroot
Define docrootweb ${basedocroot}/public
Define logdir /var/log/apache2/
<FilesMatch .php$>
SetHandler "proxy:fcgi://php:9000"
</FilesMatch>
ServerName ${server_name}
DocumentRoot ${docrootweb}
ErrorLog ${logdir}/error.log
CustomLog ${logdir}/access.log Combined
RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
<Directory ${docrootweb}>
AllowOverride All
Require all granted
</Directory>
<Directory ${basedocroot}/var>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Directory>
<Directory ${docrootweb}>
DirectoryIndex ${docrootweb}/index.php
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{HTTP:Authorization} .
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^ %{ENV:BASE}/index.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /index.php/
</IfModule>
</IfModule>
</Directory>
Undefine server_name
Undefine basedocroot
Undefine docrootweb
Undefine logdir
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment