Nginx 403 forbidden Solution

Source: Internet
Author: User

Common Causes of nginx 403 forbidden are: Missing index files and permissions.


1. Missing index.html or index. php files

Server {listen 80; server_name localhost; index. php index.html; root/var/www ;}


If no index.php or index.html is available under/var/www, the system will report 403 forbidden if the domain name is directly accessed and the file cannot be found.
For example, the index file specified by root does not exist when you access www.test.com.


2. Permission issues
Server {listen 80; server_name localhost; index. php index.html; root/var/www ;}

In this case, the current user does not have the permission to read the directory, so the 403 error will be reported.
Solution: Modify the read and write permissions of the web directory, or change the start user of nginx to the user of the directory.


[Note]: Do not forget to restart the nginx service after the configuration is modified.

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.