Principle:
Any request for a. php file is simply given to php-cgi, but the PHP file is not verified to exist.
PHP file does not exist, there is no way to return a normal 404 error, it returns a 404, and with a sentence "No input file specified"
In addition, it may be related to a path or permission, or the script_filename variable is not set correctly (this is the most common reason for nginx).
Workaround:
1 Open File: Usr/local/php/etc/php.ini, modify the following configuration
- Change Cgi.fix_pathinfo=0 to Cgi.fix_pathinfo=1
- change the cgi.force_redirect=1 to cgi.force_redirect=0 .
2 Modifying file permissions
# cd/home/wwwroot# Chown-r www:www/*# chmod-r 755/*# lnmp Restart
When it's time to execute. If there are. user.ini files in individual projects. Will prompt
chown:changing ownership of './www.test.com/.user.ini ': Operation not permitted
This is the time to enter this directory to execute
Then go to the Wwwroot directory, then execute the permissions command, and finally do not forget to enter the Www.test.com directory, execute
Last reboot
LNMP restart
Get!
Add: Linux chattr command, used to change file properties.
This directive alters the file or directory attributes stored on the ext2 file system, which have the following 8 modes:
- A: Make the file or directory available for additional use only.
- B: Do not update the last access time of the file or directory.
- C: Compress the file or directory and store it.
- D: Exclude files or directories from dumping operations.
- I: Do not alter the file or directory arbitrarily.
- S: Privacy delete files or directories.
- S: Update files or directories instantly.
- U: Remove outside of prevention.
Grammar
Chattr [-rv][-v< Version number >][+/-/=< properties >][file or directory ...]
Parameters
- -R recursively handles all files and subdirectories under the specified directory.
- -v< version number > set file or directory version.
- -V Displays the instruction execution process.
- +< Properties > Open the Item property of the file or directory.
- -< Properties > Close the Item property of the file or directory.
- The =< property > Specifies the Item property of the file or directory.
Instance
Use the chattr command to prevent a key file in the system from being modified:
Chattr +i/etc/resolv.conf
/etc/resolv. conf
The following properties are displayed
----I--------/etc/resolv.conf
Allow a file to append data only to it, but not delete it, for various log files:
Chattr +a/var/log/messages
"Lnmp" Prompt for nginx PHP "No input file specified" error resolution