禁止通过nginx访问的xml站点地图

时间:2014-10-09 10:20:44

标签: nginx

我的nginx网站配置:

upstream nodeName {
    server serverIp:7050;
    server serverIp:7049 backup;
}
server {
    listen 80;
    server_name domain.com;
    gzip_types application/x-javascript text/css;
    access_log /pathToLogs/log.access.log;
    location / {
        proxy_pass    http://nodeName/;
    }
    location ~ ^/(min/|images/|bootstrap/|ckeditor/|img/|javascripts/|apple-touch-icon-ipad.png|apple-touch-icon-ipad3.png|apple-touch-icon-iphone.png|apple-touch-icon-iphone4.png|generated/|js/|css/|stylesheets/|robots.txt|humans.txt|favicon.ico|xml/) {
          root /pathToSite/appdirectory-build;
          access_log off;
          expires max;
        }
}

我希望通过网址http://example.com/xml/sitemap.xml获取sitemap.xml,但它会给我

403 Forbidden

nginx/1.4.6 (Ubuntu)

更新

nginx错误日志文件中:

2014/10/09 [error] 16094#0: *49762240 open() "/pathToSite/appdirectory-build/xml/sitemapCallEn.xml" failed (13: Permission denied), client: Ip, server: domain.com, request: "GET /xml/sitemapCallEn.txt HTTP/1.1", host: "domain"

如何更改权限并允许打开xml文件?

1 个答案:

答案 0 :(得分:1)

查看nginx错误日志。你会在那里找到答案。它可能是文件权限问题