nginx vhost错误:未找到静态文件
我有一个vhost在提供静态文件时遇到问题: http://graphite.domain.fr/static/img/carbon-fiber.png 404 graphite.conf 图像位于正确的文件夹中,正确的chmod 644可由www数据读取:nginx vhost错误:未找到静态文件,nginx,vhosts,Nginx,Vhosts,我有一个vhost在提供静态文件时遇到问题: http://graphite.domain.fr/static/img/carbon-fiber.png 404 graphite.conf 图像位于正确的文件夹中,正确的chmod 644可由www数据读取: 原因可能是什么?/static/url下的所有资源都给我404错误http://graphite.domain.fr/static/img/carbon-fiber.png 实际上我们可以联系到,或者这只是一个例子?您能否通过HTTP i
原因可能是什么?/static/url下的所有资源都给我404错误http://graphite.domain.fr/static/img/carbon-fiber.png 实际上我们可以联系到,或者这只是一个例子?您能否通过HTTP ie本地访问该内容,http://localhost/......?It这只是一个例子,我应该可以用正确的域名访问它,但它也给了我一个404。该图像有644个chmod,可通过www-datacap读取。内容文件夹的屏幕盖也不足以推测png是否在img中,png是否有足够的权限?。您至少已经将其缩小到Web服务器本身的问题。您是否有可用的资源,或者只是img文件夹中的项目?是的,我可以使用一些内容,但不是所有url以/static/开头的文件。图像存在,chmod正确,格式正确;好啊祝你好运,但愿我知道发生了什么事!
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/;
}
}