Browse Source

Minimize site specific nginx configuration

old-stable
Mitesh Shah 11 years ago
parent
commit
4194bf7ee6
  1. 11
      config/nginx/common/php.conf
  2. 37
      config/nginx/common/w3tc.conf
  3. 46
      config/nginx/common/wpfc.conf
  4. 36
      config/nginx/common/wpsc.conf
  5. 13
      config/nginx/common/wpsubdir.conf
  6. 1
      templates/nginx/22222
  7. 1
      templates/nginx/html/basic.conf
  8. 12
      templates/nginx/mysql/basic.conf
  9. 12
      templates/nginx/php/basic.conf
  10. 12
      templates/nginx/wp/basic.conf
  11. 38
      templates/nginx/wp/w3tc.conf
  12. 47
      templates/nginx/wp/wpfc.conf
  13. 34
      templates/nginx/wp/wpsc.conf
  14. 26
      templates/nginx/wpsubdir/basic.conf
  15. 53
      templates/nginx/wpsubdir/w3tc.conf
  16. 60
      templates/nginx/wpsubdir/wpfc.conf
  17. 47
      templates/nginx/wpsubdir/wpsc.conf
  18. 12
      templates/nginx/wpsubdomain/basic.conf
  19. 38
      templates/nginx/wpsubdomain/w3tc.conf
  20. 47
      templates/nginx/wpsubdomain/wpfc.conf
  21. 37
      templates/nginx/wpsubdomain/wpsc.conf

11
config/nginx/common/php.conf

@ -0,0 +1,11 @@
# Common PHP NGINX CONFIGURATION
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}

37
config/nginx/common/w3tc.conf

@ -0,0 +1,37 @@
# Common W3TC NGINX CONFIGURATION
set $cache_uri $request_uri;
# POST Requests And Urls With A Query String Should Always Go To PHP
if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
}
# Don't Cache Uris Containing The Following Segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $cache_uri 'null cache';
}
# Don't Use The Cache For Logged In Users Or Recent Commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}
# Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress
location / {
try_files /wp-content/cache/page_enhanced/${host}${cache_uri}_index.html $uri $uri/ /index.php?$args;
}
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ {
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}

46
config/nginx/common/wpfc.conf

@ -0,0 +1,46 @@
# Common WPFC NGINX CONFIGURATION
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
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
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;
}
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ {
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
}
location ~ \.php$ {
try_files $uri =404;
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";
}

36
config/nginx/common/wpsc.conf

@ -0,0 +1,36 @@
# Common WPSC NGINX CONFIGURATION
set $cache_uri $request_uri;
# POST Requests And Urls With A Query String Should Always Go To PHP
if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
}
# Don't Cache Uris Containing The Following Segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $cache_uri 'null cache';
}
# Don't Use The Cache For Logged In Users Or Recent Commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}
# Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress
location / {
try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
# Following Line Is Needed By WP SUPER CACHE Plugin
fastcgi_param SERVER_NAME $http_host;
}

13
config/nginx/common/wpsubdir.conf

@ -0,0 +1,13 @@
# Common WPSUBDIRECTORY NGINX CONFIGURATION
if (!-e $request_filename) {
# Redirect wp-admin To wp-admin/
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# Redirect wp-* Files/Folders
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
# Redirect Other PHP Files
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}

1
templates/nginx/22222

@ -32,6 +32,7 @@ server {
}
location ~ \.php$ {
include common/acl.conf;
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;

1
templates/nginx/html/basic.conf

@ -1,4 +1,5 @@
# HTML NGINX CONFIGURATION
server {
server_name example.com www.example.com;

12
templates/nginx/mysql/basic.conf

@ -1,4 +1,5 @@
# MYSQL NGINX CONFIGURATION
server {
server_name example.com www.example.com;
@ -9,16 +10,7 @@ server {
root /var/www/example.com/htdocs;
index index.php index.htm index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}
include common/php.conf;
include common/locations.conf;
}

12
templates/nginx/php/basic.conf

@ -1,4 +1,5 @@
# PHP NGINX CONFIGURATION
server {
server_name example.com www.example.com;
@ -9,16 +10,7 @@ server {
root /var/www/example.com/htdocs;
index index.php index.htm index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}
include common/php.conf;
include common/locations.conf;
}

12
templates/nginx/wp/basic.conf

@ -1,4 +1,5 @@
# WPSINGLE BASIC NGINX CONFIGURATION
server {
server_name example.com www.example.com;
@ -9,16 +10,7 @@ server {
root /var/www/example.com/htdocs;
index index.php index.htm index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}
include common/php.conf;
include common/wpcommon.conf;
include common/locations.conf;

38
templates/nginx/wp/w3tc.conf

@ -1,4 +1,5 @@
# WPSINGLE W3 TOTAL CACHE NGINX CONFIGURATION
server {
server_name example.com www.example.com;
@ -9,42 +10,7 @@ server {
root /var/www/example.com/htdocs;
index index.php index.htm index.html;
set $cache_uri $request_uri;
# POST Requests And Urls With A Query String Should Always Go To PHP
if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
}
# Don't Cache Uris Containing The Following Segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $cache_uri 'null cache';
}
# Don't Use The Cache For Logged In Users Or Recent Commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}
# Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress
location / {
try_files /wp-content/cache/page_enhanced/${host}${cache_uri}_index.html $uri $uri/ /index.php?$args;
}
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ {
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}
include common/w3tc.conf;
include common/wpcommon.conf;
include common/locations.conf;

47
templates/nginx/wp/wpfc.conf

@ -1,4 +1,5 @@
# WPSINGLE FAST CGI NGINX CONFIGURATION
server {
server_name example.com www.example.com;
@ -9,51 +10,7 @@ server {
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
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
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;
}
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ {
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
}
location ~ \.php$ {
try_files $uri =404;
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";
}
include common/wpfc.conf;
include common/wpcommon.conf;
include common/locations.conf;
}

34
templates/nginx/wp/wpsc.conf

@ -1,4 +1,5 @@
# WPSINGLE WP SUPER CACHE NGINX CONFIGURATION
server {
server_name example.com www.example.com;
@ -9,38 +10,7 @@ server {
root /var/www/example.com/htdocs;
index index.php index.htm index.html;
set $cache_uri $request_uri;
# POST Requests And Urls With A Query String Should Always Go To PHP
if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
}
# Don't Cache Uris Containing The Following Segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $cache_uri 'null cache';
}
# Don't Use The Cache For Logged In Users Or Recent Commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}
# Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress
location / {
try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}
include common/wpsc.conf;
include common/wpcommon.conf;
include common/locations.conf;
}

26
templates/nginx/wpsubdir/basic.conf

@ -1,4 +1,5 @@
# WPSUBDIR BASIC NGINX CONFIGURATION
server {
# Uncomment The Following Line For Domain Mapping
@ -15,28 +16,9 @@ server {
root /var/www/example.com/htdocs;
index index.php index.htm index.html;
if (!-e $request_filename) {
# Redirect wp-admin To wp-admin/
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# Redirect wp-* Files/Folders
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
# Redirect Other PHP Files
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}
include common/php.conf;
include common/wpsubdir.conf;
include common/wpcommon.conf;
include common/locations.conf;

53
templates/nginx/wpsubdir/w3tc.conf

@ -1,4 +1,5 @@
# WPSUBDIR W3 TOTAL CACHE NGINX CONFIGURATION
server {
# Uncomment The Following Line For Domain Mapping
@ -14,55 +15,9 @@ server {
root /var/www/example.com/htdocs;
index index.php index.htm index.html;
set $cache_uri $request_uri;
# POST Requests And Urls With A Query String Should Always Go To PHP
if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
}
# Don't Cache Uris Containing The Following Segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $cache_uri 'null cache';
}
# Don't Use The Cache For Logged In Users Or Recent Commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}
if (!-e $request_filename) {
# Redirect wp-admin To wp-admin/
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# Redirect wp-* Files/Folders
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
# Redirect Other PHP Files
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
# Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress
location / {
try_files /wp-content/cache/page_enhanced/${host}${cache_uri}_index.html $uri $uri/ /index.php?$args;
}
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ {
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}
include common/w3tc.conf;
include common/wpsubdir.conf;
include common/wpcommon.conf;
include common/locations.conf;

60
templates/nginx/wpsubdir/wpfc.conf

@ -1,4 +1,5 @@
# WPSUBDIR FAST CGI NGINX CONFIGURATION
server {
# Uncomment The Following Line For Domain Mapping
@ -15,63 +16,8 @@ server {
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
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
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;
}
if (!-e $request_filename) {
# Redirect wp-admin To wp-admin/
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# Redirect wp-* Files/Folders
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
# Redirect Other PHP Files
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
# Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ {
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
}
location ~ \.php$ {
try_files $uri =404;
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";
}
include common/wpfc.conf;
include common/wpsubdir.conf;
include common/wpcommon.conf;
include common/locations.conf;
}

47
templates/nginx/wpsubdir/wpsc.conf

@ -1,4 +1,5 @@
# WPSUBDIR WP SUPER CACHE NGINX CONFIGURATION
server {
# Uncomment The Following Line For Domain Mapping
@ -15,50 +16,8 @@ server {
root /var/www/example.com/htdocs;
index index.php index.htm index.html;
set $cache_uri $request_uri;
# POST Requests And Urls With A Query String Should Always Go To PHP
if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
}
# Don't Cache Uris Containing The Following Segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $cache_uri 'null cache';
}
# Don't Use The Cache For Logged In Users Or Recent Commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}
if (!-e $request_filename) {
# Redirect wp-admin To wp-admin/
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# Redirect wp-* Files/Folders
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
# Redirect Other PHP Files
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
# Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress
location / {
try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}
include common/wpsc.conf;
include common/wpsubdir.conf;
include common/wpcommon.conf;
include common/locations.conf;

12
templates/nginx/wpsubdomain/basic.conf

@ -1,4 +1,5 @@
# WPSUBDOMAIN BASIC NGINX CONFIGURATION
server {
# Uncomment The Following Line For Domain Mapping
@ -15,16 +16,7 @@ server {
root /var/www/example.com/htdocs;
index index.php index.htm index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}
include common/php.conf;
include common/wpcommon.conf;
include common/locations.conf;

38
templates/nginx/wpsubdomain/w3tc.conf

@ -1,4 +1,5 @@
# WPSUBDOMAIN W3 TOTAL CACHE NGINX CONFIGURATION
server {
# Uncomment The Following Line For Domain Mapping
@ -15,42 +16,7 @@ server {
root /var/www/example.com/htdocs;
index index.php index.htm index.html;
set $cache_uri $request_uri;
# POST Requests And Urls With A Query String Should Always Go To PHP
if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
}
# Don't Cache Uris Containing The Following Segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $cache_uri 'null cache';
}
# Don't Use The Cache For Logged In Users Or Recent Commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}
# Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress
location / {
try_files /wp-content/cache/page_enhanced/${host}${cache_uri}_index.html $uri $uri/ /index.php?$args;
}
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ {
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
}
include common/w3tc.conf;
include common/wpcommon.conf;
include common/locations.conf;

47
templates/nginx/wpsubdomain/wpfc.conf

@ -1,4 +1,5 @@
# WPSUBDOMAIN FAST CGI NGINX CONFIGURATION
server {
# Uncomment The Following Line For Domain Mapping
@ -15,51 +16,7 @@ server {
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
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
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;
}
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ {
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
}
location ~ \.php$ {
try_files $uri =404;
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";
}
include common/wpfc.conf;
include common/wpcommon.conf;
include common/locations.conf;
}

37
templates/nginx/wpsubdomain/wpsc.conf

@ -1,4 +1,5 @@
# WPSUBDOMAIN WP SUPER CACHE NGINX CONFIGURATION
server {
# Uncomment The Following Line For Domain Mapping
@ -15,41 +16,7 @@ server {
root /var/www/example.com/htdocs;
index index.php index.htm index.html;
set $cache_uri $request_uri;
# POST Requests And Urls With A Query String Should Always Go To PHP
if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
}
# Don't Cache Uris Containing The Following Segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $cache_uri 'null cache';
}
# Don't Use The Cache For Logged In Users Or Recent Commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}
# Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress
location / {
try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
# Following Line Is Needed By WP SUPER CACHE Plugin
fastcgi_param SERVER_NAME $http_host;
}
include common/wpsc.conf;
include common/wpcommon.conf;
include common/locations.conf;

Loading…
Cancel
Save