I have setup an nginx server with php5-fpm. When I try to load the site I get a blank page with no errors. Html pages are served fine but not php. I tried turning on display_errors in php.ini but no luck. php5-fpm.log is not producing any errors and neither is nginx.
nginx.conf
server {
listen 80;
root /home/mike/www/606club;
index index.php index.html;
server_name mikeglaz.com www.mikeglaz.com;
error_log /var/log/nginx/error.log;
location ~ \.php$ {
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
EDIT
here's my nginx error log:
2013/03/15 03:52:55 [error] 1020#0: *55 open() "/home/mike/www/606club/robots.txt" failed (2: No such file or directory), client: 199.30.20.40, server: mikeglaz.com, request: "GET /robots.txt HTTP/1.1", host: "mikeglaz.com"
Many users fall in this thread expecting to find a solution for blank pages being displayed while using nginx+php5-fpm, me being one of them. This is a recap of what I ended up doing after reading many of the answers here plus my own investigations:
1) Open
/etc/php5/fpm/pool.d/www.conf
and check the value of parameterlocation
.2) Parameter
location
should matchfastcgi_pass
parameter in yournginx.conf
file.3) Check the file actually exists:
4) If it doesn't exist that means php5-fpm is not running, so you need to restart it:
With regard to the
location
section:Check the file
fastcgi_params
exists at location/etc/nginx/
:Generally this file contains a list of variable definitions required by php5-fpm:
nginx includes two possible parameter files: fastcgi_params and fastcgi.conf. The difference between both is the definition of variable
SCRIPT_FILENAME
:To make a long story short, fastcgi.conf should always work. If for some reason you're using fastcgi_params, you should define
SCRIPT_FILENAME
:Now reload nginx configuration:
And check a php file is displayed correctly. For instance:
/var/www/html/test.php
Where
/var/www/html
is the path to the document root.If you getting a blank screen, that may be because of 2 reasons:
Browser blocking the Frames from being displayed. In some browsers the frames are considered as unsafe. To overcome this you can launch the frameless version of phpPgAdmin by
http://-your-domain-name-/intro.php
You have enabled a security feature in Nginx for X-Frame-Options try disabling it.
None of the above answers worked for me - PHP was properly rendering everything except pages that relied on mysqli, for which it was sending a blank page with a 200 response code and not throwing any errors. As I'm on OS X, the fix was simply
sudo port install php56-mysql
followed by a restart of PHP-FPM and nginx.
I was migrating from an older Apache/PHP setup to nginx, and failed to notice the version mismatch in the driver for
php-mysql
andphp-fpm
.I had a similar problem, nginx was processing a page halfway then stopping. None of the solutions suggested here were working for me. I fixed it by changing nginx fastcgi buffering:
After the changes my
location
block looked like:For details see https://www.namhuy.net/3120/fix-nginx-upstream-response-buffered-temporary-file-error.html
replace
with
and remove fastcgi_param SCRIPT_FILENAME ... in nginx.conf
Add this in
/etc/nginx/conf.d/default.conf
: