Handling 403 Forbidden issues

Handling 403 Forbidden issues

Continued: When accessing the front end, report 403 Forbidden issues_€☞Sweeper Monk☜€'s blog-CSDN blog deals with 403 Forbidden issues.

If the 403 problem cannot be solved, it may be that when docker mounts the container, the path of the mount mapping file does not correspond, and you need to review the mount command again. For example:

docker run -d --name platformnginx -p 8081:80 -v /mnt/nginx/nginx.conf:/etc/nginx/nginx.conf -v /mnt/nginx/logs:/var/log/nginx -v /mnt/nginx/html:/usr/share/nginx/html -v /mnt/nginx/conf:/etc/nginx/conf.d --privileged=true nginx

Analyzing the mount command, we can see that:

-v /mnt/nginx/html:/usr/share/nginx/html: Map the /mnt/nginx/html directory on the host to the /usr/share/nginx/html directory in the container, so that the static on the host The webpage files are placed in the default webpage directory of Nginx.

View the root configuration in default.conf

The root root directory address is the specified address inside the container (/usr/share/nginx/html), because dist is a folder, so add dist to the url in the root root directory, such as the following files

 location / {
        root   /usr/share/nginx/html/dist;
        index  index.html index.htm; 
    }

Put the front-end static resources in the /mnt/nginx/html directory on the host

Restart nginx and check whether the static resources have been mapped into the nginx container

Revisit URL: http://IP:port

 

 

Guess you like

Origin blog.csdn.net/weixin_56602545/article/details/130419473