Skip to content

Instantly share code, notes, and snippets.

@typomedia
Created May 25, 2015 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save typomedia/1637ffb90443b41afdde to your computer and use it in GitHub Desktop.
Save typomedia/1637ffb90443b41afdde to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name domain.tld;
set $root_path '/usr/share/nginx/domain.tld/public';
root $root_path;
expires 1M;
access_log /var/log/nginx/$host-access.log;
error_log /var/log/nginx/$host-error.log error;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php {
# try_files $uri =404;
fastcgi_index /index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# Set expires max on static file types
location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|$
expires max;
root $root_path;
access_log off;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment