From 78872a534b90f1d1cd3d11e742f1b2d85fd253ed Mon Sep 17 00:00:00 2001 From: ffais Date: Fri, 25 Oct 2024 15:53:32 +0200 Subject: [PATCH] chore(plugins): update w3tc nginx conf Signed-off-by: ffais --- wordpress/confs/nginx/nginx-w3tc-snippet.conf | 410 +++++++++++++++++- 1 file changed, 409 insertions(+), 1 deletion(-) diff --git a/wordpress/confs/nginx/nginx-w3tc-snippet.conf b/wordpress/confs/nginx/nginx-w3tc-snippet.conf index c73a2f3..fc2ad6f 100644 --- a/wordpress/confs/nginx/nginx-w3tc-snippet.conf +++ b/wordpress/confs/nginx/nginx-w3tc-snippet.conf @@ -12,7 +12,415 @@ location ~ /wp-content/cache/page_enhanced.*gzip$ { } # END W3TC Page Cache cache # BEGIN W3TC Browser Cache -# gzip on; +gzip on; +gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon application/json application/vnd.ms-access video/webm application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint image/svg+xml application/x-shockwave-flash image/tiff application/x-font-ttf audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel; +location ~ \.(css|htc|less|js|js2|js3|js4)$ { + expires 31536000s; + etag on; + if_modified_since exact; + add_header Pragma "public"; + add_header Cache-Control "public"; + add_header Referrer-Policy "no-referrer-when-downgrade"; + try_files $uri $uri/ /index.php?$args; +} +location ~ \.(html|htm|rtf|rtx|txt|xsd|xsl|xml)$ { + etag on; + if_modified_since exact; + add_header Pragma "public"; + add_header Cache-Control "max-age=3600, public"; + add_header Referrer-Policy "no-referrer-when-downgrade"; + try_files $uri $uri/ /index.php?$args; +} +location ~ \.(asf|asx|wax|wmv|wmx|avi|avif|avifs|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|webp|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|webm|mpp|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|_ttf|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ { + expires 31536000s; + etag on; + if_modified_since exact; + add_header Pragma "public"; + add_header Cache-Control "public"; + add_header Referrer-Policy "no-referrer-when-downgrade"; + + location ~* ^(?.+)\.(jpe?g|png|gif)$ { + if ( $http_accept !~* "webp|\*/\*" ) { + break; + } + + expires 31536000s; + etag on; + if_modified_since exact; + add_header Pragma "public"; + add_header Cache-Control "public"; + add_header Referrer-Policy "no-referrer-when-downgrade"; + add_header Vary Accept; + try_files ${path}.webp $uri /index.php?$args; + } + + try_files $uri $uri/ /index.php?$args; +} +add_header Referrer-Policy "no-referrer-when-downgrade"; +# END W3TC Browser Cache +# BEGIN W3TC Page Cache core +set $w3tc_query_string $query_string; +if ($w3tc_query_string ~* "^(.*?&|)ScCid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)_branch_match_id(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)_bta_c(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)_bta_tid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)_ga(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)_gl(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)_ke(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)adgroupid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)adid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)age\-verified(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)ao_noptimize(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)campaignid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)campid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)click_id(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)cn\-reloaded(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)customid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)dicbo(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)dm_i(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)ef_id(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)epik(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)fb_action_ids(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)fb_action_types(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)fb_source(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)fbclid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)gclid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)gclsrc(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)gdffi(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)gdfms(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)gdftrk(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)hsa_acc(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)hsa_ad(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)hsa_cam(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)hsa_grp(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)hsa_kw(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)hsa_mt(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)hsa_net(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)hsa_src(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)hsa_tgt(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)hsa_ver(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)igshid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)li_fat_id(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)matomo_campaign(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)matomo_cid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)matomo_content(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)matomo_group(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)matomo_keyword(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)matomo_medium(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)matomo_placement(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)matomo_source(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)mc_cid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)mc_eid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)mkcid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)mkevt(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)mkrid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)mkwid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)msclkid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)mtm_campaign(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)mtm_cid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)mtm_content(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)mtm_group(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)mtm_keyword(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)mtm_medium(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)mtm_placement(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)mtm_source(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)pcrid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)piwik_campaign(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)piwik_keyword(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)piwik_kwd(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)pk_campaign(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)pk_cid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)pk_content(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)pk_keyword(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)pk_kwd(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)pk_medium(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)pk_source(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)pp(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)redirect_log_mongo_id(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)redirect_mongo_id(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)ref(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)s_kwcid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)sb_referer_host(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)si(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)sscid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)tblci(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)toolid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)trk_contact(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)trk_module(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)trk_msg(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)trk_sid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)ttclid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)twclid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)usqp(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)utm_campaign(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)utm_content(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)utm_expid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)utm_id(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)utm_medium(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)utm_source(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)utm_term(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~* "^(.*?&|)wbraid(=[^&]*)?(&.*|)$") { + set $w3tc_query_string $1$3; +} +if ($w3tc_query_string ~ ^[?&]+$) { + set $w3tc_query_string ""; +} +set $w3tc_request_uri $request_uri; +if ($w3tc_request_uri ~* "^([^?]+)\?") { + set $w3tc_request_uri $1; +} +set $w3tc_rewrite 1; +if ($request_method = POST) { + set $w3tc_rewrite 0; +} +if ($w3tc_query_string != "") { + set $w3tc_rewrite 0; +} +set $w3tc_slash ""; +if ($w3tc_request_uri ~ \/$) { + set $w3tc_slash _slash; +} +if ($http_cookie ~* "(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle)") { + set $w3tc_rewrite 0; +} +set $w3tc_preview ""; +if ($http_cookie ~* "(w3tc_preview)") { + set $w3tc_preview _preview; +} +set $w3tc_ssl ""; +if ($scheme = https) { + set $w3tc_ssl _ssl; +} +if ($http_x_forwarded_proto = 'https') { + set $w3tc_ssl _ssl; +} +set $w3tc_enc ""; +if ($http_accept_encoding ~ gzip) { + set $w3tc_enc _gzip; +} +if (!-f "$document_root/wp-content/cache/page_enhanced/$http_host/$w3tc_request_uri/_index$w3tc_slash$w3tc_ssl$w3tc_preview.html$w3tc_enc") { + set $w3tc_rewrite 0; +} +if ($w3tc_rewrite = 1) { + rewrite .* "/wp-content/cache/page_enhanced/$http_host/$w3tc_request_uri/_index$w3tc_slash$w3tc_ssl$w3tc_preview.html$w3tc_enc" last; +} +# END W3TC Page Cache core +cat: can't open ': No such file or directory +dslab-wordpress-php-6d9ccd4fbb-5zn44:/var/www/html$ ^C +dslab-wordpress-php-6d9ccd4fbb-5zn44:/var/www/html$ cat nginx.conf +# BEGIN W3TC Page Cache cache +location ~ /wp-content/cache/page_enhanced.*gzip$ { + gzip off; + types {} + default_type text/html; + add_header Content-Encoding gzip; + etag on; + if_modified_since exact; + add_header Pragma "public"; + add_header Cache-Control "max-age=3600, public"; + add_header Referrer-Policy "no-referrer-when-downgrade"; +} +# END W3TC Page Cache cache +# BEGIN W3TC Browser Cache +gzip on; gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon application/json application/vnd.ms-access video/webm application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint image/svg+xml application/x-shockwave-flash image/tiff application/x-font-ttf audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel; location ~ \.(css|htc|less|js|js2|js3|js4)$ { expires 31536000s;