Nginx root directory 403

nginx main configuration:

server {
    listen       80;
    server_name  www.xxx.cn;

    -sharpcharset koi8-r;

    -sharpaccess_log  logs/host.access.log  main;

    location /admin/ {
         root   /app/server;
         try_files $uri $uri/ /admin/index.html;
    }

    location / {
       root /app/server;
       try_files $uri $uri/ /client/index.html;
    }
}

now only when you visit www.xxx.cn, you will report 403. If you visit www.xxx.cn/aa, you will have no problem. After taking a look at the solutions on the Internet, you basically say that you want to change your permission. I have the permission to change / app/server/client and index.html , but it is still 403.

clipboard.png

clipboard.png

-----------------update1---------------------------

clipboard.png

this is the error_log of the past two days. The mistakes of the middle two invalid number can be ignored. I wrote it wrong

.

-update2-

checked again and found that there is a problem with the configuration of selinux , but I have seen that selinux is already disabled on my machine, so it should not be the problem of selinux ? In the past, there was no problem when there was only one entry for the whole website. Since I divided the admin and client of the site into two front-end projects, it has been a problem to configure two portals in nginx .

Feb.28,2021

The problem that

tormented me for several days was finally solved.

in fact, as mentioned in many articles, the index needs to be added to both routes and points to the corresponding index.html

.

clipboard.png

clipboard.png


paste error_log


nginx is generally run with a user like www-data , and you need to give www-data read permission. Or change the owner to www-data.


write index index.html after root

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b317ba-2bda4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b317ba-2bda4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?