Nginx + php-fpm File not found. Problem Solving record

Source: Internet
Author: User
Tags 403 forbidden error
This article describes the content of Nginx + php-fpm File not found. Problem solving records, with a certain reference value, now share to everyone, have the need for friends can refer to

Confirmation of the phenomenon:

Open the browser's developer tool to view the request information


http/1.1 404 Not Found

server:nginx/1.11.10

Date:fri, 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

Indicates that the result was returned by FASTCGI.


Cause of the problem:


The estimate is related to authority.


the same configuration, using the following two:

/opt/local/share/nginx/html  /opt/local/share/nginx/html/php

Directories are available, but use:

/users/xxx/downloads/workforder

The directory is not available.

Viewing permissions through Ls-l, the difference is that


/users/xxx/downloads/workforder

The files in the directory do not have an extended attribute, that is, there is no @ symbol.


Then modify the nginx static file root directory to:


/users/xxx/downloads/workforder

Access appears:

403 Forbidden Error

Look at Nginx 403, find the cause of the problem, you need to modify the configuration file in the user and group.

The format of Nginx is:

User name/root owner, for example: User root owner;

PHP-FPM the respective modifications:

user = Rootgroup = Owner

and then restart.

PHP-FPM itself does not have the command to restart, compare pits! Can only kill the process.

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;         }

This shows only the parts that are relevant to PHP. When I join in the configuration


Try_files $uri = 404;
, you will see the returned by Nginx:



When you access a PHP file, you may see an error such as the following:


That is because FastCGI does not start and needs to be started:

sudo php-fpm-  D

And if both Nginx and PHP point to the same directory, you will still see:

File not found

Related Article

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.