Created
June 21, 2014 06:44
-
-
Save kokuyouwind/ca4e803cec4f85d91b4e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
include /etc/nginx/drop; | |
##fastcgi_cache start | |
#set $no_cache 0; | |
# | |
## POST requests and urls with a query string should always go to PHP | |
#if ($request_method = POST) { | |
# set $no_cache 1; | |
#} | |
#if ($query_string != "") { | |
# set $no_cache 1; | |
#} | |
# | |
## Don't cache uris containing the following segments | |
#if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { | |
# set $no_cache 1; | |
#} | |
# | |
## Don't use the cache for logged in users or recent commenters | |
#if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") { | |
# set $no_cache 1; | |
#} | |
# This order might seem weird - this is attempted to match last if rules below fail. | |
location / { | |
try_files $uri $uri/ /index.php?$args; | |
} | |
# Add trailing slash to */wp-admin requests. | |
rewrite /wp-admin$ $uri/ permanent; | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
include /etc/nginx/expires; | |
log_not_found off; | |
} | |
# Pass all .php files onto a php-fpm/php-fcgi server. | |
location ~ \.php$ { | |
#limit_req zone=method; | |
try_files $uri =404; | |
expires off; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass phpfpm; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
fastcgi_intercept_errors on; | |
fastcgi_connect_timeout 60; | |
fastcgi_send_timeout 180; | |
fastcgi_read_timeout 180; | |
fastcgi_buffer_size 128k; | |
fastcgi_buffers 4 256k; | |
fastcgi_busy_buffers_size 256k; | |
fastcgi_temp_file_write_size 256k; | |
fastcgi_param REMOTE_ADDR $http_x_real_ip; | |
fastcgi_pass_header "X-Accel-Redirect"; | |
fastcgi_pass_header "X-Accel-Buffering"; | |
fastcgi_pass_header "X-Accel-Charset"; | |
fastcgi_pass_header "X-Accel-Expires"; | |
fastcgi_pass_header "X-Accel-Limit-Rate"; | |
# fastcgi cache | |
#fastcgi_cache_bypass $no_cache; | |
#fastcgi_no_cache $no_cache; | |
#fastcgi_cache fastcgizone; | |
#fastcgi_cache_valid 60m; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment