Skip to content

Instantly share code, notes, and snippets.

@tvlooy
Created November 23, 2016 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tvlooy/d5079cafde617744b0ef56017165b51a to your computer and use it in GitHub Desktop.
Save tvlooy/d5079cafde617744b0ef56017165b51a to your computer and use it in GitHub Desktop.
PHP 7 FPM on Apache 2.2 with PHP 5 mod_php running
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
RewriteEngine On
RewriteCond %{HTTP_HOST} !www.example.com [NC]
RewriteRule ^(.*)$ http://www.example.com$1 [L,R=301]
DocumentRoot /var/www/example/current/web
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/example/current/web>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
# disable mod_php5
php_value engine off
AddHandler php7-fcgi .php
Action php7-fcgi /php7-fcgi
Alias /php7-fcgi /usr/lib/cgi-bin/php7-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -host 127.0.0.1:9070 -pass-header Authorization
<FilesMatch ".+\.php$">
SetHandler php7-fcgi
</FilesMatch>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType application/font-woff "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType font/woff "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
</IfModule>
ErrorLog /var/www/example/logs/error.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel warn
CustomLog /var/www/example/logs/access.log ip_combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment