Mitesh Shah
11 years ago
21 changed files with 179 additions and 441 deletions
@ -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; |
|||
} |
@ -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; |
|||
} |
@ -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"; |
|||
} |
@ -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; |
|||
} |
@ -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; |
|||
} |
Loading…
Reference in new issue