Skip to content

Instantly share code, notes, and snippets.

@sn
Last active August 29, 2015 14:11
Show Gist options
  • Save sn/6bac786fd175f471b64e to your computer and use it in GitHub Desktop.
Save sn/6bac786fd175f471b64e to your computer and use it in GitHub Desktop.
Kirby Nginx configuration file for site running on PHP FastCGI
server {
listen 80;
listen [::]:80;
root /var/www/site;
index index.php index.html index.htm;
server_name _;
autoindex on;
access_log off;
# Kirby Specific Directories
rewrite ^/site/(.*) /error permanent;
rewrite ^/kirby/(.*) /error permanent;
location ~ .php {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
include fastcgi_params;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* .(?:xml|ogg|mp3|mp4|ogv|svg|svgz|eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico)$ {
try_files $uri =404;
expires max;
access_log off;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment