Skip to content

Instantly share code, notes, and snippets.

@gbaldera
Created July 1, 2014 18:45
Show Gist options
  • Save gbaldera/2895d9c50880513d758c to your computer and use it in GitHub Desktop.
Save gbaldera/2895d9c50880513d758c to your computer and use it in GitHub Desktop.
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name pyrocms.localhost;
root /var/www/pyrocms;
index index.php;
error_page 404 = /index.php;
client_max_body_size 200M;
fastcgi_intercept_errors off;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 180;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location /installer {
try_files $uri $uri/ /installer/index.php;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
location ~ /\.ht {
deny all;
}
charset utf-8;
# Favicon
location ~* \.ico$ {
expires 1w;
access_log off;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# Media: images, video, audio, HTC, WebFonts
location ~* \.(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ {
expires 1M;
access_log off;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# CSS and Javascript
location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# opt-in to the future
add_header "X-UA-Compatible" "IE=Edge,chrome=1";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment