繁体   English   中英

Nginx位置禁止使用403

[英]403 forbidden for nginx locations

我有一个sites-enabled/default Nginx sites-enabled/default配置:

server {
        listen 80;

        server_name localhost;


        location / {
                proxy_pass http://localhost:3000;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
        }
        location ~ /anotherroute {
                alias /home/anotherroute/public;
                index index.html;
        }
}

当我访问http://myipaddress/anotherroute它工作正常,但是当我做http://myipaddress/anotherroute/yetanotherroute它回来为403 forbidden

我怎样才能解决这个问题?

可能您的文件夹还存在yetanotherroute ,请确保您已经有文件index.phpindex.html

否则,您应该指定一个文件名,例如: http://myipaddress/anotherroute/yetanotherroute/somefile.php

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM