Home > Article > Backend Development > Nginx PHP returns 200, but blank page_PHP tutorial
ngxin; After php-fpm is installed, the html static page is fine, but although the phpinfo page returns 200, it is always a blank page
There is no error. It is considered that nginx has transferred the php page to php for processing, so the problem should be in the configuration of php. After searching, I found that I need to add a sentence to nginx
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
After installing nginx, the default fastcgi_params configuration file does not have the above sentence.
In nginx.conf
location ~ .php$ {
root
Fastcgi_pass 127.0.0.1:9000 ;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
Include fastcgi_params;
}
Or add it to the fastcgi_params configuration file
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;