403 Forbidden errors for nginx means that you are requesting a resource file but nginx does not allow you to view it. 403 Forbidden is just an HTTP status code, like 404,200 is not a technical error. Which scenes need to return a scene with a 403 status code?
1. The website prohibits specific users from accessing all content. For example, the website blocks an ip access. 2. Access the directory that prohibits directory browsing. For example, set autoindex off to access the directory. 3. The user accesses files that can only be accessed by the intranet.
There are several common scenarios where you need to return to 403 Forbidden.
Due to server-side misconfiguration, 403 Forbidden is returned when you don't want
nginx returns 403.
1. Permission configuration is incorrect
This is the most common reason why nginx appears 403 forbidden. In order to ensure that the file can be executed correctly, nginx requires both the read permission of the file and the executable permission of all parent directories of the file. For example, when accessing /usr/local/nginx/html/image.jpg, nginx requires both readable permissions for the image.jpg file and /, /usr, /usr/local, /usr/local/nginx, /Usr/local/nginx/html can execute permissions. Solution: Set all parent directories to 755 permissions, and set the file to 644 permissions to avoid incorrect permissions.
2. Directory index setting error (index directive configuration)
The website root directory does not contain the file set by the index directive. For example, a website running PHP is usually configured like this index index index.html index.htm index.php;
When accessing the site, nginx will follow index.html, index.htm, index.php The order of the files in the root directory. If none of these three files exist, nginx will return 403 Forbidden.
If index.php is not defined in index, nginx returns 403 Forbidden directly and does not check if index.php exists. Similarly, if you run jsp, py also need to add index.jsp, index.py to the directory index directive index. Solution: Add the home page file to the index directive, which is usually index.php, index.jsp, index.jsp or a custom home page file.
What is the most regrettable thing for intranet users? Of course, it
Todays classmates computer IIS server suddenly has a problem, let me help, I look
Use the administrators account to join the computer to the domain. Can I use anoth
This article aims to teach the first contact with VPS novice, if you are a veteran. Can leave, there
Web Hosting IIS Prevents Intrusion Common Q&A
Memory DIMM installation configuration and memory slot distribution of the R525 G2 server
Open apache or nginx webpage gzip compression
How to modify the default web port of apache
How to set up a DHCP server under Win2000 Server
Actually repair disk array Raid-d volume
Five recommendations to improve the security of intranet servers
Set up a server cluster based on Linux (2.6 kernel)
How to set up Wake on LAN for T168 G6/T468 G6 server?
What's new in win8 How much can you really use?
Win10 10122 two tips for creating a local account
What should I do if the Win7 computer suddenly has a blue screen?
Method of installing Windows 8 and Windows Server 2012 dual system
What to do after the black screen of Windows8 patching
How to play positive and negative symbols in the Win7 system
How to adjust the one-button audio and video mode under Win8 system?
Windows 7 Fast Sharing Internet Wireless Network Connection
Three ways to teach you to solve the problem of the wifi sharing wizard can not open the
Win7 press the keyboard U button to pop up easy access how to solve?