The webpage displays 403 Forbidden Nginx (yum installation log is usually in /var/log/nginx/error.log) error log display open() "/web/www/one.txt" failed (13: Permission denied), client: 192.168.1.110, server: rumenz.com, request: "GET /one.txt HTTP/1.1", host: "rumenz.com" There are four reasons for this:
Solution: SELinux is not disabled 1.1 Temporarily disable SELinux, but it will be enabled again after restarting the operating system setenforce=0 1.2 Permanently disable SELinux vim /etc/selinux/config Change SELINUX=enforcing to SELINUX=disabled Nginx startup user and working user are inconsistent [root@rumenz#]ps aux | grep "nginx: worker process" | awk '{print $1}' nobody root Modify Nginx configuration file vim /etc/nginx/nginx.conf Change user nobody to user root; restart Nginx Note: The startup user and working user of Nginx can be different, but the permissions of the web directory must be configured so that the working user has the permission to access the web directory Directory permissions issue where the web page is located 3.1 Fine-grained control: The root directory of the web page must have x permissions (that is, you can cd into it), and the parent directory where the web page is located must have r (read permission) 3.2 Simple and crude (not recommended, unsafe, but effective): chmod -R 777 /web chmod -R 777 /web/www Missing default homepage 4.1 After the permissions are assigned, why does the homepage still show 403 Forbidden? 4.2 The root directory of the webpage provides a default homepage: index.html This is the end of this article about how to solve 403 forbidden with Nginx. For more information about how to solve 403 forbidden with Nginx, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Vue custom encapsulated button component
>>: Differences between MySQL MyISAM and InnoDB
Table of contents 1. Rendering 2. Bind data and a...
Database transaction isolation level There are 4 ...
Table of contents Thoughts triggered by an online...
If you cannot download it by clicking downloadlao...
Table of contents How to view the source code of ...
Table of contents 1. Aggregate Query 1. COUNT fun...
This article example shares the specific code of ...
This article mainly introduces the sql script fun...
Web Server 1. The web server turns off unnecessar...
MySQL handles GROUP BY and DISTINCT queries simil...
Table of contents 1. Browser support 2. export ex...
PS: I've recently been reading the Nginx chap...
Table of contents 1. Test Data 2. The inconvenien...
1. Get the real path of the current script: #!/bi...