Nginx with php-fpm generating blank page
255
post-template-default,single,single-post,postid-255,single-format-standard,bridge-core-3.0.1,qodef-qi--touch,qi-addons-for-elementor-1.5.3,qode-page-transition-enabled,ajax_updown,page_not_loaded,,vertical_menu_enabled,no_animation_on_touch,side_area_uncovered_from_content,qode-theme-ver-28.7,qode-theme-bridge,disabled_footer_top,qode_header_in_grid,wpb-js-composer js-comp-ver-6.8.0,vc_responsive,elementor-default,elementor-kit-6

Nginx with php-fpm generating blank page

Nginx with php-fpm generating blank page

I struggled a long time trying to figure out why my nginz + php-fpm setup was not working. I could tell that the gateway was fine and I was getting a HTTP 200 OK response, but the output was blank and there were no illuminating entries in either the nginx or php-fpm logs.

After a ton of research, I found the hint that I needed here:

https://bbs.archlinux.org/viewtopic.php?pid=903811#p903811

Essentially, I needed to set the SCRIPT_FILENAME param like so:

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

Php_fpm needs this so that it knows the path to the PHP file. You may need to set this param differently according to where you store your PHP files.

The default nginx setup I used includes a fastcgi_params file and a fastcgi.conf file. The fastcgi.conf file defines SCRIPT_FILENAME whereas the fastcgi_params does not. My guess is that the fastcgi.conf is not being used, which is why SCRIPT_FILENAME was not set.



Mastodon