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.
60 lines
1.5 KiB
60 lines
1.5 KiB
12 years ago
|
# WPSINGLE FAST CGI NGINX CONFIGURATION
|
||
12 years ago
|
server {
|
||
|
|
||
|
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;
|
||
|
index index.php index.htm index.html;
|
||
|
|
||
|
set $skip_cache 0;
|
||
|
|
||
|
# POST Requests And Urls With A Query String Should Always Go To PHP
|
||
|
if ($request_method = POST) {
|
||
|
set $skip_cache 1;
|
||
|
}
|
||
|
|
||
|
if ($query_string != "") {
|
||
|
set $skip_cache 1;
|
||
|
}
|
||
|
|
||
|
# 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 $skip_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 $skip_cache 1;
|
||
|
}
|
||
|
|
||
|
# Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress
|
||
|
location / {
|
||
|
try_files $uri $uri/ /index.php?$args;
|
||
|
}
|
||
|
|
||
11 years ago
|
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ {
|
||
11 years ago
|
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
|
||
|
}
|
||
|
|
||
11 years ago
|
location ~ \.php$ {
|
||
11 years ago
|
try_files $uri =404;
|
||
12 years ago
|
include fastcgi_params;
|
||
|
fastcgi_pass php;
|
||
|
|
||
|
fastcgi_cache_bypass $skip_cache;
|
||
|
fastcgi_no_cache $skip_cache;
|
||
|
|
||
|
fastcgi_cache WORDPRESS;
|
||
|
}
|
||
|
|
||
|
location ~ /purge(/.*) {
|
||
|
fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1";
|
||
|
}
|
||
|
|
||
11 years ago
|
include common/wpcommon.conf;
|
||
|
include common/locations.conf;
|
||
12 years ago
|
}
|