【发布时间】:2018-02-01 18:42:21
【问题描述】:
我的 nginx vhost 配置内容:
server {
listen 80;
server_name t.xianzhi.xxx.domain;
access_log /data/log/nginx/t.xianzhi.xxx.domain_access.log main;
location ~ /\. {deny all;}
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
location = / {
root /data/web/static/html;
index index.html;
}
location / {
proxy_pass http://127.0.0.1:9000;
}
location = /favicon.ico {
access_log off;
root /data/web/static/;
}
location = /apple-app-site-association {
add_header Content-Type "text/html; charset=utf-8";
root /data/web/show/public/wap/;
}
location ~ \.(css|js|png|jpg|woff|ttf)$ {
root /data/web/static;
expires 10d;
}
}
作为配置,我想将路径 / 提供给 /data/web/static/html/index.html 并将其他路径提供给 proxy_pass。
事实是/的路径是404没有找到,其他的都是成功的。
日志是:
24/Aug/2017:10:49:43 +0800 10.5.17.37 t.xianzhi.xxx.domain - curl/7.51.0 - request:GET / HTTP/1.1 bbs:233status:404 upad:127.0.0.1:9000 rspt:0.017 rqtt:0.017 request_body:-
所以,/ 被传递给代理。
一些信息:
nginx版本:nginx/1.10.1
那么,如何解决呢?
【问题讨论】:
标签: nginx nginx-location