Skip to content

Instantly share code, notes, and snippets.

@julienbourdeau
Last active August 29, 2015 14:04
Show Gist options
  • Save julienbourdeau/d8568ba3779269443843 to your computer and use it in GitHub Desktop.
Save julienbourdeau/d8568ba3779269443843 to your computer and use it in GitHub Desktop.
server {
server_name _DOMAIN_;
root /home/_USER_/www/wordpress;
index index.php;
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
charset utf-8;
rewrite ^/favicon.png$ /favicon.ico last;
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, max-age, must-revalidate, proxy-revalidate";
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
access_log /var/log/nginx/_DOMAIN_.access.log;
error_log /var/log/nginx/_DOMAIN_.error.log;
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location ~ \.php$ {
try_files $uri = 404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm._DOMAIN_.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment