Solve the Problem of Nginx 403 forbidden, nginx403

Source: Internet
Author: User
Tags 403 forbidden error

Solve the Problem of Nginx 403 forbidden, nginx403

Solve the Problem of 403 forbidden in Nginx.

When configuring the static page of nginx

Server {listen 80; server_name localhost; # Some configuration content is omitted here: location/{# root html; # index index.html index.htm; root/home/myapp/; index index.html ;} # Some configuration content is omitted here}
After the configuration is complete, enable nginx and report the 403 forbidden error.

The main cause of the error is permission issues.

1. Caused by inconsistent startup users and nginx working users (for test purposes)
1. view the configuration file nginx. conf.

First line

# User nobody;
2. changed to "root", which is the user currently logged on to. If you log on with another user name, change it to the same name as the login name.
User root;
2. directory permission issues. If nginx does not have the operation permission for the web directory, the error 403 will also occur.

Solution: Modify the read and write permissions of the web directory, or change the start user of nginx to the user of the directory. Restart Nginx to solve the problem.

Chmod-R 777/data

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.