nginx permission root


nginx 权限问题的解决方法


	listen 4002;
	server_name localhost;
	access_log logs/access.log;
	location / {
	   proxy_set_header X-Real-IP $remote_addr;
	   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	   proxy_set_header Host $http_host;
	   proxy_set_header X-NginxX-Proxy true;
	   proxy_pass http://backend;
	   proxy_redirect off;	   
	   proxy_http_version 1.1;
	   proxy_set_header Upgrade $http_upgrade;
	   proxy_set_header Connection "upgrade";
	 upstream backend {

参照nginx 13:permission denied solved
The root directive is the problem here. Quote from the doc:
note: Keep in mind that the root will still append the directory to the request so that a request for “/i/top.gif” will not look in “/spool/w3/top.gif” like might happen in an Apache-like alias configuration where the location match itself is dropped. Use the alias directive to achieve the Apache-like functionality.
Basically, only use root for real roots: if the content is to be at / use root. If it’s going to end on a subfolder, use alias:

location  /map/ {
  alias  /home/user/public_html/map/;
}   Also check what user nginx is running as and make sure that this user can access /home/user/public_html/map