Today in the start of a Docker run Nginx instance, when the directory is mounted, access to the static directory, insufficient permissions
The commands executed are:
Docker run
--name my-nginx
-d-p 80:80
--restart=always
-v/cloud/nginx/webroot:/usr/share/nginx/ HTML:RW
-v/cloud/nginx/log:/var/log/nginx
-v/cloud/nginx/config/nginx.conf:/etc/nginx/nginx.conf:ro -
D Nginx
Description
1. Where/cloud/nginx/webroot is my host directory, used to store static face pages
2./cloud/nginx/log Store Log
3./cloud/nginx/config/nginx.conf as Nginx configuration file
Docker run
--name my-nginx
-d-p 80:80
--restart=always
-v/cloud/nginx/webroot:/usr/share/nginx/ HTML:RW
-v/cloud/nginx/log:/var/log/nginx
-v/cloud/nginx/config/nginx.conf:/etc/nginx/nginx.conf:ro -
D Nginx
Use the View Log command to display the following:
2018/02/02 02:45:12 [ERROR] 5#5: *1 "/usr/share/nginx/html/index.html" is forbidden (13:permission denied), client:10.11 3.51, Server:localhost, Request: "get/http/1.1", Host: "10.11.3.86"
2018/02/02 02:45:12 [ERROR] 5#5: *1 "/usr/shar E/nginx/html/index.html "is forbidden (13:permission denied), client:10.11.3.51, Server:localhost, request:" Get/http /1.1 ", Host:" 10.11.3.86 "
After discovering that the host's directory permissions are not enough, so decisively plus parameters:
--privileged=true
The complete command is as follows:
Docker run
--name my-nginx
-d-p 80:80
--restart=always
--privileged=true
-v/cloud/nginx/ WEBROOT:/USR/SHARE/NGINX/HTML:RW
-v/cloud/nginx/log:/var/log/nginx
-v/cloud/nginx/config/nginx.conf:/ Etc/nginx/nginx.conf:ro-
D nginx
Plus boot container, access is 0k.