Nginx Run PHP program when the return 200 access is a blank page problem resolution

Source: Internet
Author: User
Tags blank page

After installing PHP-FPM in Ngxin, the HTML static page is no problem, however, although the Phpinfo page returns 200 status code, the browsing is always blank and there is no error.

Consider should be Nginx has moved the PHP page to PHP processing, so the problem should be in the configuration of PHP, after searching, found that need to add a sentence in 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 the nginx.conf

Copy the Code code as follows:

Location ~. php$ {
root HTML;
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 include in the Fastcgi_params configuration file:

Copy the Code code as follows:

# PHP only, required if PHP is built with--enable-force-cgi-redirect
Fastcgi_param Redirect_status 200;
Fastcgi_param script_filename $document _root$fastcgi_script_name;

Restart Nginx to display the page normally.


This article is from the "Savage Power" blog, please be sure to keep this source http://chenfei123.blog.51cto.com/1427669/1703224

Nginx Run PHP program when the return 200 access is a blank page problem resolution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.