tags:

views:

46

answers:

1

I would like to nginx to serve a static file from website root ( : http://localhost:8080/ ) but it serves my proxy pass; 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 ?

+1  A: 

Use this one:

location = / {
    index index.html;
}

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