Skip to content

Instantly share code, notes, and snippets.

@jimjamdev
Last active August 29, 2015 14:05
Show Gist options
  • Save jimjamdev/3d5491d2475be2411ba3 to your computer and use it in GitHub Desktop.
Save jimjamdev/3d5491d2475be2411ba3 to your computer and use it in GitHub Desktop.
Nginx Config for Craft CMS / BuildWithCraft
server {
listen 8080;
#listen [::]:80 default_server ipv6only=on;
root /var/www/craftsite.com/public;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name craftsite.com;
port_in_redirect off;
server_tokens off;
autoindex off;
# Define default caching of 24h
expires 86400s;
add_header Pragma public;
add_header Cache-Control "max-age=86400, public, must-revalidate, proxy-revalidate";
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ ^(.*)$ {
try_files $uri $uri/ /index.php?p=$uri&$args;
}
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location = /robots.txt { access_log off; log_not_found off; }
location = /favicon.ico { access_log off; log_not_found off; }
location ~ /\. { access_log off; log_not_found off; deny all; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment