Created
May 25, 2015 07:52
-
-
Save typomedia/1637ffb90443b41afdde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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