3
votes

I've just installed nginx and php7.0-fpm on clear debian 9 and tried to configure it by standard way, but when i try to access http://mysite/test.php i get blank page. There aren't any errors in /var/log/nginx/error.log or /var/log/php7.0-fpm.log files (i get 200 answers, but page is blank). My configs files below..

/var/www/html/test.php

<?php phpinfo(); ?>

nginx.conf

http {
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

server {
    listen 80;
    server_name _;

    root /var/www/html;
    index test.php;
    location ~* \.php$ {
        try_files $uri =404;
            include /etc/nginx/fastcgi.conf;
            fastcgi_pass  127.0.0.1:9000;
    }

}
#include /etc/nginx/conf.d/*.conf;
#include /etc/nginx/sites-enabled/*;
}

/etc/php/7.0/fpm/pool.d/www.conf

[www]
user = www-data
group = www-data
listen = 127.0.0.1:9000
listen.owner = www-data
listen.group = www-data
2
Also i have 777 permissions for /var/www/html/test.php and /etc/nginx/fastcgi.conf file.Nitro Boy
have you restarted the services?Ice76
@Ice76, sure, php and nginx were restartedNitro Boy
never give 777 permission even for the sake of testing. 665 is okay, but if you are thinking in such a way, that even just for your satisfaction don't go beyond 775.Ahmad Bilal

2 Answers

2
votes

Try to pass the socket path instead of server:port:

fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;

Also, the server_name _; will work only if a default server is specified, are you sure the 200 code comes from from the url you requested (you should rule out possible failbacks to other vhost)?

0
votes

Try adding: fastcgi_param SCRIPT_FILENAME $realpath_root/test.php;

You shouldn't have to 777 anything.