Created
May 19, 2014 11:34
-
-
Save x1024/d07622ff5e3b5be95cb9 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 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
root SITE_PATH_HERE; | |
index index.php index.html index.htm; | |
server_name SERVER_NAME_HERE; | |
client_max_body_size 10M; | |
gzip on; | |
gzip_types text/plain text/css text/javascript application/x-javascript; | |
gzip_disable "msie6"; | |
gzip_static on; | |
gzip_vary on; | |
gzip_proxied any; | |
gzip_comp_level 6; | |
gzip_buffers 16 8k; | |
gzip_http_version 1.1; | |
add_header X-XSS-Protection "0"; | |
expires modified +24h; | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires 1y; | |
log_not_found off; | |
} | |
# enforce NO www | |
if ($host ~* ^www\.(.*)) | |
{ | |
set $host_without_www $1; | |
rewrite ^/(.*)$ $scheme://$host_without_www/$1 | |
permanent; | |
} | |
# unless the request is for a valid file, send to bootstrap | |
if (!-e $request_filename) | |
{ | |
rewrite ^(.+)$ /index.php?q=$1 last; | |
} | |
location / { | |
# First attempt to serve request as file, then | |
# as directory, then fall back to displaying a 404. | |
try_files $uri $uri/ /index.html; | |
# Uncomment to enable naxsi on this location | |
# include /etc/nginx/naxsi.rules | |
} | |
error_page 404 /index.php; | |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment