Home > Article > Backend Development > Nginx + PHP-fpm File not found. Problem solving record
The content of this article is about Nginx PHP-fpm File not found. Problem solving record, which has certain reference value. Now I share it with you. Friends in need can refer to it
Phenomenon confirmation:
Open the browser's developer tools and view the request information
<br>
HTTP/1.1 404 Not Found
Server: nginx/1.11. 10
Date: Fri, 20 Apr 2018 08:10:13 GMT
Content-Type: text/html; charset=UTF- 8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.6.30
Explain that the result is returned by FastCGI.
<br>
Cause of the problem:
<br>
It is probably related to permissions
<br>
The same configuration, using the following two:
/opt/local/share/nginx/html /opt/local/share/nginx/html/php
directory is OK, but using:
/Users/xxx/Downloads/workForder
directory is not .
Check the permissions through ls -l and find that the difference is that the files in the
<br>
/Users/xxx/Downloads/workForder
directory do not have extended attributes, that is, there is no @ symbol.
<br>
Later, the static file root directory of Nginx was modified to:
<br>
/Users/xxx/Downloads/workForder
Access appears:
Look at nginx 403 again, and find the cause of the problem. You need to modify the user and group in the configuration file.
## The format of nginx is: <br>
user 你的用户名/root owner; 比如: user root owner;## Modify #PHP-fpm respectively:
user = root group = owner<br> and then restart.
PHP-fpm itself does not have a restart command, which is quite confusing! The only way is to kill the process.
<br>
Configuration file: # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /Users/xxx/Downloads/workForder;
# root /opt/local/share/nginx/html/php;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
Only the parts related to PHP are shown here. When I add
<br>
try_files $uri =404;
后,就会看到由Nginx返回的:
<br>
## to the configuration, you may see an error like the following:<br>
That’s because FastCGI has not been started and needs to be started: <br>
sudo php-fpm -DAnd if Nginx and PHP both point to the same directory, then they will still see To: File not found
The above is the detailed content of Nginx + PHP-fpm File not found. Problem solving record. For more information, please follow other related articles on the PHP Chinese website!