You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.3 KiB
47 lines
1.3 KiB
12 years ago
|
# WPSINGLE WP SUPER CACHE NGINX CONFIGURATION
|
||
12 years ago
|
server {
|
||
12 years ago
|
|
||
12 years ago
|
server_name example.com www.example.com;
|
||
|
|
||
12 years ago
|
access_log /var/log/nginx/example.com.access.log rt_cache;
|
||
12 years ago
|
error_log /var/log/nginx/example.com.error.log;
|
||
|
|
||
|
root /var/www/example.com/htdocs;
|
||
12 years ago
|
index index.php index.htm index.html;
|
||
12 years ago
|
|
||
|
set $cache_uri $request_uri;
|
||
|
|
||
12 years ago
|
# POST Requests And Urls With A Query String Should Always Go To PHP
|
||
12 years ago
|
if ($request_method = POST) {
|
||
|
set $cache_uri 'null cache';
|
||
12 years ago
|
}
|
||
|
|
||
12 years ago
|
if ($query_string != "") {
|
||
|
set $cache_uri 'null cache';
|
||
|
}
|
||
|
|
||
12 years ago
|
# Don't Cache Uris Containing The Following Segments
|
||
11 years ago
|
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
|
||
12 years ago
|
set $cache_uri 'null cache';
|
||
|
}
|
||
|
|
||
12 years ago
|
# Don't Use The Cache For Logged In Users Or Recent Commenters
|
||
12 years ago
|
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
|
||
|
set $cache_uri 'null cache';
|
||
|
}
|
||
|
|
||
12 years ago
|
# Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress
|
||
12 years ago
|
location / {
|
||
12 years ago
|
try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php;
|
||
12 years ago
|
}
|
||
|
|
||
11 years ago
|
location ~ \.php$ {
|
||
11 years ago
|
try_files $uri =404;
|
||
12 years ago
|
include fastcgi_params;
|
||
12 years ago
|
fastcgi_pass php;
|
||
12 years ago
|
}
|
||
|
|
||
11 years ago
|
include common/wpcommon.conf;
|
||
|
include common/locations.conf;
|
||
12 years ago
|
}
|