Skip to content

Instantly share code, notes, and snippets.

@williejackson
Created July 18, 2013 04:48
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 williejackson/defdbaba9c71572abc6e to your computer and use it in GitHub Desktop.
Save williejackson/defdbaba9c71572abc6e to your computer and use it in GitHub Desktop.
server {
listen 80;
port_in_redirect off;
server_name www.domain.com;
rewrite ^ http://domain.com$request_uri? permanent;
}
server {
listen 80;
port_in_redirect off;
server_name domain.com;
autoindex off;
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
rewrite ^/news_sitemap\.xml$ /index.php?sitemap=wpseo_news last;
root /home/user/public_html/webroot;
index index.php index.html index.htm index.phtml;
location /nginx_status { stub_status on; access_log off; }
location ~ ^/(status|ping) {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php5-fpm.sock;
allow 127.0.0.1;
deny all;
}
location / { try_files $uri $uri/ /index.php?q=$uri&$args; }
location ~ /(\.|wp-config.php|readme.html|licence.txt) { return 404; }
location = /favicon.ico { log_not_found off; access_log off; }
location ~ /\. { deny all; access_log off; log_not_found off; }
location = /robots.txt { allow all; log_not_found off; access_log off; }
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { log_not_found off; access_log off; }
location ~* \.(?:asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|otf|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|t?gz|tif|tiff|ttf|wav|webm|wma|woff|wri|xla|xls|xlsx|xlt|xlw|zip)$ { expires max; }
location ~* (^(?!(?:(?!(php|inc)).)*/uploads/).*?(php)) {
try_files $uri =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_ignore_client_abort off;
fastcgi_pass php5-fpm-sock;
}
include /home/user/public_html/webroot/nginx.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment