Home › Forums › WoodMart support forum › FastCGI cache on NGINX causes blank screen in pages
FastCGI cache on NGINX causes blank screen in pages
- This topic has 2 replies, 2 voices, and was last updated 5 hours, 29 minutes ago by josh-6874.
-
AuthorPosts
-
January 13, 2025 at 11:17 am #629196
josh-6874ParticipantI have the exact same configurations for my other NGINX server with Porto theme and this never happens. Please review my settings and advise:
fastcgi_cache_path /var/cache/nginx/fastcgi_temp/ levels=1:2 keys_zone=WORDPRESS:200m max_size=10g inactive=60m use_temp_path=off; fastcgi_cache_key "$scheme$request_method$host$request_uri"; server { listen 443 ssl ; http2 on ; listen [::]:443 ssl ; server_name jmic.co.kr www.jmic.co.kr; # managed by Certbot ssl_certificate /etc/letsencrypt/live/jmic.co.kr/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/jmic.co.kr/privkey.pem; # managed by Certbot root /var/www/html/; index index.php; # set max upload size client_max_body_size 2G; fastcgi_buffers 64 4K; access_log /var/log/nginx/wordpress_https_access.log combined; error_log /var/log/nginx/wordpress_https_error.log; server_tokens off; # START FastCGI # POST requests and urls with a query string should always go to PHP if ($request_method = POST) { set $skip_cache 1; } if ($request_method = PATCH) { set $no_cache 1; } if ($query_string != "") { set $skip_cache 1; } # Don't cache uris containing the following segments if ($request_uri ~* "/wishlist/|/my-cart/|/checkout/|/my-account/|/wp-admin/|/xmlrpc.php|wp-.*.php|^/feed/*|/tag/.*/feed/*|index.php|/.*sitemap.*\.(xml|xsl|html)") { 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; } # END FastCGI # BEGIN CompressX set $ext_avif ".avif"; if ($http_accept !~* "image/avif") { set $ext_avif ""; } set $ext_webp ".webp"; if ($http_accept !~* "image/webp") { set $ext_webp ""; } location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif|webp)$ { add_header Vary Accept; add_header Cache-Control "private"; expires 365d; try_files /wp-content/compressx-nextgen/$path.$ext$ext_avif /wp-content/compressx-nextgen/$path.$ext$ext_webp $uri = 404; } # END CompressX ## # BEGIN Nginx Bad Bot Blocker Includes # REPO: https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker ## include /etc/nginx/bots.d/ddos.conf; include /etc/nginx/bots.d/blockbots.conf; # END Nginx Bad Bot Blocker Includes include /etc/nginx/site-extras/*.conf; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location / { try_files $uri $uri/ /index.php?$args ; } location ~* \.(htaccess|htpasswd) { deny all; } location ~* \.(?:ini|conf|txt)$ { deny all; } location ~ \.php(?:$|/) { fastcgi_split_path_info ^(.+\.php)(/.+)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param HTTPS on; fastcgi_pass 127.0.0.1:9000; fastcgi_read_timeout 60s; # START FastCGI configurations fastcgi_cache WORDPRESS; fastcgi_cache_valid 200 301 302 60m; fastcgi_cache_use_stale error timeout updating invalid_header http_500 http_503; fastcgi_cache_min_uses 1; fastcgi_cache_lock on; fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; fastcgi_ignore_headers Cache-Control Expires Set-Cookie; add_header X-FastCGI-Cache $upstream_cache_status; # END FastCGI configurations } ## START SEOPress sitemap location location ~ (([^/]*)sitemap(.*)|news|author|video(.*))\.x(m|s)l$ { rewrite ^.*/sitemaps\.xml$ /index.php?seopress_sitemap=1 last; rewrite ^.*/news.xml$ /index.php?seopress_news=1 last; rewrite ^.*/video([0-9]+)?.xml$ /index.php?seopress_video=1&seopress_paged=$1 last; rewrite ^.*/author.xml$ /index.php?seopress_author=1 last; rewrite ^.*/sitemaps_xsl\.xsl$ /index.php?seopress_sitemap_xsl=1 last; rewrite ^.*/sitemaps_video_xsl\.xsl$ /index.php?seopress_sitemap_video_xsl=1 last; rewrite ^.*/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?seopress_cpt=$1&seopress_paged=$2 last; } ## END SEOPress sitemap location #START Staging Site SSL location location /dev { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404, #try_files $uri $uri/ = 404; try_files $uri $uri/ /dev/index.php?$args; } #END Staging Site SSL location # set long EXPIRES header on static assets location ~* ^.+\.(?:css|js|eot|otf|ttf|woff|woff2|svg|font.css)$ { expires 30d; access_log off; } #CDN CORS policy font fix location ~* \.(css|js|eot|otf|ttf|woff|woff2|svg|font.css)$ { add_header Access-Control-Allow-Origin *; } # Rocket-Nginx configuration include rocket-nginx/conf.d/default.conf; }
January 13, 2025 at 1:25 pm #629246
Artem TemosKeymasterHello,
To assist you more effectively, could you please provide additional details regarding the issues you’re experiencing? Including screenshots and a step-by-step guide to reproduce the problem on your website would greatly aid us in diagnosing and resolving the issue.
Best regards,
January 15, 2025 at 3:33 am #629789
josh-6874ParticipantPages other than the main page turns blank when FastCGI is enabled with the NGINX configurations above.
I have commented out the configurations to restore the site and it is functioning normally now.Steps to produce:
1. Uncomment FastCGI settings
2. Reload/restart NGINX server
3. After some time, pages other than the main page / homepage results in blank screen (without any error messages). -
AuthorPosts
- You must be logged in to create new topics. Login / Register