Permission issues lead to Nginx 403 Forbidden Error Resolution _nginx

Source: Internet
Author: User
Tags 403 forbidden error

Today in a new environment to install NGINX, the results are accessed by 403

Usually show 403 I immediately think of the path configuration is wrong, but I looked carefully, the directory path is no problem:

Nginx.conf:

Copy Code code as follows:

server {
Listen 80;
server_name localhost;

#charset Koi8-r;

#access_log Logs/host.access.log Main;

Location/{
root/root/html;
Index index.html index.htm;
}
}

Path query results in the system:
Copy Code code as follows:

[Root@lizhong html]# ll/root/html/
Total Dosage 4
-rw-r--r--1 root root 3 April 11:07 index.html

Directory, restart Nginx or this error, later thought is not a permission issue? Then add a line to the nginx.conf head:

Copy Code code as follows:
User root;

Restart Nginx, and then you can access it normally.

Restart Nginx, and then you can access it normally.

If you do not want to run with root, you can resolve the 403 problem by modifying directory access, but you cannot place the directory in the root user host directory, place it in any location and give it 755, or change its owner and Nginx by Chown to resolve permissions issues.

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.