开发者

nginx rule to serve root

I would like to nginx to serve a static file from website root ( : http://localhost:8080/ ) but it serves my proxy pass; 开发者_JAVA百科it serves "/" rule instead of "= /".

Here is what my nginx config look like :

listen 0.0.0.0:8080;
server_name localhost;

set $static_dir /path/to/static/

location = / {
  # got index.html in /path/to/static/html/index.html
  root $static_dir/html/;
}

location / {
  # ...
  proxy_pass http://app_cluster_1/;
}

Did i miss something ?


Use this one:

location = / {
    index index.html;
}

location = /index.html {
    root /your/root/here;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜