diff --git a/config/nginx/common/php.conf b/config/nginx/common/php.conf new file mode 100644 index 00000000..d2fb215f --- /dev/null +++ b/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; +} diff --git a/config/nginx/common/w3tc.conf b/config/nginx/common/w3tc.conf new file mode 100644 index 00000000..67e91591 --- /dev/null +++ b/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; +} diff --git a/config/nginx/common/wpfc.conf b/config/nginx/common/wpfc.conf new file mode 100644 index 00000000..fd0cc722 --- /dev/null +++ b/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"; +} diff --git a/config/nginx/common/wpsc.conf b/config/nginx/common/wpsc.conf new file mode 100644 index 00000000..f0be1136 --- /dev/null +++ b/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; +} diff --git a/config/nginx/common/wpsubdir.conf b/config/nginx/common/wpsubdir.conf new file mode 100644 index 00000000..daed4e7c --- /dev/null +++ b/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; +} diff --git a/templates/nginx/22222 b/templates/nginx/22222 index 7b0ca38c..b6ee881e 100644 --- a/templates/nginx/22222 +++ b/templates/nginx/22222 @@ -32,6 +32,7 @@ server { } location ~ \.php$ { + include common/acl.conf; try_files $uri =404; include fastcgi_params; fastcgi_pass php; diff --git a/templates/nginx/html/basic.conf b/templates/nginx/html/basic.conf index fe26d276..7856f2fc 100644 --- a/templates/nginx/html/basic.conf +++ b/templates/nginx/html/basic.conf @@ -1,4 +1,5 @@ # HTML NGINX CONFIGURATION + server { server_name example.com www.example.com; diff --git a/templates/nginx/mysql/basic.conf b/templates/nginx/mysql/basic.conf index 052a85c6..542fd96d 100644 --- a/templates/nginx/mysql/basic.conf +++ b/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; } diff --git a/templates/nginx/php/basic.conf b/templates/nginx/php/basic.conf index 73306b92..d41768c9 100644 --- a/templates/nginx/php/basic.conf +++ b/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; } diff --git a/templates/nginx/wp/basic.conf b/templates/nginx/wp/basic.conf index d8a11e3e..61e26f63 100644 --- a/templates/nginx/wp/basic.conf +++ b/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; diff --git a/templates/nginx/wp/w3tc.conf b/templates/nginx/wp/w3tc.conf index 6dd96ca9..f3f4da97 100644 --- a/templates/nginx/wp/w3tc.conf +++ b/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; diff --git a/templates/nginx/wp/wpfc.conf b/templates/nginx/wp/wpfc.conf index 5d343a74..3be1710e 100644 --- a/templates/nginx/wp/wpfc.conf +++ b/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; } diff --git a/templates/nginx/wp/wpsc.conf b/templates/nginx/wp/wpsc.conf index 41ea856f..1590185a 100644 --- a/templates/nginx/wp/wpsc.conf +++ b/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; } diff --git a/templates/nginx/wpsubdir/basic.conf b/templates/nginx/wpsubdir/basic.conf index 938a44a3..cc292c4d 100644 --- a/templates/nginx/wpsubdir/basic.conf +++ b/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; diff --git a/templates/nginx/wpsubdir/w3tc.conf b/templates/nginx/wpsubdir/w3tc.conf index 192bc9ab..0131a379 100644 --- a/templates/nginx/wpsubdir/w3tc.conf +++ b/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; diff --git a/templates/nginx/wpsubdir/wpfc.conf b/templates/nginx/wpsubdir/wpfc.conf index 4bb901b5..1a376756 100644 --- a/templates/nginx/wpsubdir/wpfc.conf +++ b/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; } diff --git a/templates/nginx/wpsubdir/wpsc.conf b/templates/nginx/wpsubdir/wpsc.conf index 56694d53..f40bef48 100644 --- a/templates/nginx/wpsubdir/wpsc.conf +++ b/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; diff --git a/templates/nginx/wpsubdomain/basic.conf b/templates/nginx/wpsubdomain/basic.conf index fba6b628..8b7c3faa 100644 --- a/templates/nginx/wpsubdomain/basic.conf +++ b/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; diff --git a/templates/nginx/wpsubdomain/w3tc.conf b/templates/nginx/wpsubdomain/w3tc.conf index 8308fec7..743a1656 100644 --- a/templates/nginx/wpsubdomain/w3tc.conf +++ b/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; diff --git a/templates/nginx/wpsubdomain/wpfc.conf b/templates/nginx/wpsubdomain/wpfc.conf index 8c7b5186..ac7797dc 100644 --- a/templates/nginx/wpsubdomain/wpfc.conf +++ b/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; } diff --git a/templates/nginx/wpsubdomain/wpsc.conf b/templates/nginx/wpsubdomain/wpsc.conf index a1afa690..19e8a599 100644 --- a/templates/nginx/wpsubdomain/wpsc.conf +++ b/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;