40 lines
1.4 KiB
Plaintext
40 lines
1.4 KiB
Plaintext
# WordPress single blog rules.
|
|
# Designed to be included in any server {} block.
|
|
|
|
# This order might seem weird - this is attempted to match last if rules below fail.
|
|
# http://wiki.nginx.org/HttpCoreModule
|
|
location / {
|
|
try_files $uri $uri/ /index.php?$args;
|
|
}
|
|
|
|
# Add trailing slash to */wp-admin requests.
|
|
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
|
|
|
|
# Directives to send expires headers and turn off 404 error logging.
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
|
|
expires 24h;
|
|
}
|
|
|
|
# Uncomment one of the lines below for the appropriate caching plugin (if used).
|
|
#include global/wordpress-supercache.conf;
|
|
#include global/wordpress-w3cache.conf;
|
|
|
|
# Pass all .php files onto a php-fpm/php-fcgi server.
|
|
location ~ \.php$ {
|
|
# Zero-day exploit defense.
|
|
# http://forum.nginx.org/read.php?2,88845,page=3
|
|
# Won't work properly (404 error) if the file is not stored on this server, which is entirely possible with php-fpm/php-fcgi.
|
|
# Comment the 'try_files' line out if you set up php-fpm/php-fcgi on another machine. And then cross your fingers that you won't get hacked.
|
|
try_files $uri =404;
|
|
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
|
|
|
|
include fastcgi_params;
|
|
fastcgi_index index.php;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
# fastcgi_intercept_errors on;
|
|
fastcgi_pass php;
|
|
}
|
|
|