Nginx prompts No input file specified problem solution tutorial

Source: Internet
Author: User

1. In the configuration of php. ini (/usr/local/php/etc/php. ini), find

Cgi. fix_pathinfo = 0
Change it
Cgi. fix_pathinfo = 1
 
2. Note the following in the nginx configuration file/etc/nginx/conf/nginx. conf:

The code is as follows: Copy code
Location ~ . Php $ {
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME/home/www/blog $ fastcgi_script_name;
Include fastcgi_params;
}

 
The red path must be set based on your host's main directory.
After configuring the preceding sections, restart nginx and php-fpm. The problem is successful.

In addition, it may be related to the path or permission, or the SCRIPT_FILENAME variable is not correctly set (this is the most common reason for nginx)

1) If the error 404 occurs in html, the document root settings are incorrect.
2) Check the permissions of the script file. PHP or web server may not be able to read it.
3) incorrect SCRIPT_FILENAME settings

Solution:

If the SCRIPT_FILENAME setting error is ruled out, the problem occurs in the access to directory folders and files. Reset the permissions of the www user group to immediately access the background. Here, I would like to express my special thanks to Ku Tong shoes.

The SSH command used to set permissions is

The code is as follows: Copy code

Chown-vR www: www/folder

Supplement: set parameters for my SCRIPT_FILENAME

Fcvim GI. conf (SCRIPT_FILENAME directory)

The code is as follows: Copy code

Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
Fastcgi_param SCRIPT_NAME $ fastcgi_script_name;
Fastcgi_param REQUEST_URI $ request_uri;
Fastcgi_param DOCUMENT_URI $ document_uri;
Fastcgi_param DOCUMENT_ROOT $ document_root;
Fastcgi_param SERVER_PROTOCOL $ server_protocol;

The corresponding document_root permission must be the same as that of nginx. conf and fcgi. conf.

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.