nginx vhost错误:找不到静态文件

时间:2014-08-13 21:21:38

标签: nginx vhosts

我有一个vhost服务静态文件有问题: http://graphite.domain.fr/static/img/carbon-fiber.png 404

graphite.conf

server {
    listen 80;
    server_name graphite.domain.fr;
    client_max_body_size 64M;
    keepalive_timeout 5;

    # path for static files
    root /opt/graphite/webapp/content;

    location /media/ {
      root /opt/graphite/lib/python2.7/site-packages/django/contrib/admin;
    }

    auth_basic "Area 51, password please!";
    auth_basic_user_file /home/ansible/grafana/.htpasswd;

    location / {

        if ($http_origin ~* (http://graphite.domain.fr)) {
            set $cors "true";
        }

        if ($cors = 'true') {
            add_header  Access-Control-Allow-Origin $http_origin;    
            add_header  "Access-Control-Allow-Credentials" "true";         
            add_header  "Access-Control-Allow-Methods" "GET, OPTIONS";
            add_header  "Access-Control-Allow-Headers" "Authorization, origin, accept";
        }

        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_connect_timeout 10;
        proxy_read_timeout 10;
        proxy_pass http://localhost:8080/;
    }
}

图像位于右侧文件夹中,www-data可读取正确的chmod(644):

enter image description here

可能是什么原因? / static / url下的所有资源都给出了404错误

0 个答案:

没有答案
相关问题