Nginx 反向代理 Tomcat 返回403错误(权限问题)

nginx 配置如下 ,访问域名报错403错误
 

server{
        listen       80;
        server_name  portal.oceanstone.cn;
        #location / {
            #root   /app/site/portal.oceanstone.cn;
            #index  index.html index.htm;
        #}

        #location /site/portal.oceanstone.cn{
            #root   /app;
            #index  index.html index.htm;

        #}
            root   /app/cms/apache-tomcat-9.0.52/webapps/ms-mcms/html/web;
            index  index.html index.htm;
        
          
        location ~ \.(html|htm)$ {  
       root /app/cms/apache-tomcat-9.0.52/webapps/ms-mcms/html/web;
   }     
        
        location /img/ {
                root /app/; 
                autoindex on;
        }
       #location /api { 
            #proxy_pass   http://127.0.0.1:8115/api;
            #client_max_body_size 5000m;
       # }
} 

修改方法:

将 #user nobody; 改为 user root;

保存,重新启动nginx

猜你喜欢

转载自blog.csdn.net/wd520521/article/details/119886433
今日推荐