Skip to content

Instantly share code, notes, and snippets.

@phbergsmann
Created April 4, 2014 14:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save phbergsmann/9975380 to your computer and use it in GitHub Desktop.
Save phbergsmann/9975380 to your computer and use it in GitHub Desktop.
NGINX configuration for TYPO3 with HHVM and PHP-FPM Fallback
server {
listen 80;
server_name localhost;
root /var/www;
client_max_body_size 32M;
location = /clear.gif {
empty_gif;
expires max;
}
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}
location / {
server_tokens off;
try_files $uri $uri/ /index.php;
index index.html index.htm index.php;
if (-f $request_filename) {
break;
}
if (-d $request_filename) {
break;
}
if (-e $request_filename) {
break;
}
if ($request_uri ~ '^/(typo3(/|conf|temp)|fileadmin|uploads|t3lib|index.php|favicon.ico)') {
break;
}
if (!-f $request_filename) {
rewrite .* /index.php last;
return 200;
}
}
location ~* "\.js\.gzip$" {
add_header Content-Encoding gzip;
gzip off;
default_type application/javascript;
}
location ~* "\.css\.gzip$" {
add_header Content-Encoding gzip;
gzip off;
types { text/css gzip; }
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 360d;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name;
include fastcgi_params;
fastcgi_intercept_errors on;
error_page 500 = @fpm;
}
location @fpm {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment