règle nginx pour servir root

Je voudrais nginx pour servir un fichier statique à partir de la racine du site Web (: http: // localhost: 8080 / ) mais il sert mon pass proxy; il sert la règle “/” au lieu de “= /”.

Voici à quoi ressemble ma configuration nginx:

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/; } 

Ai-je manqué quelque chose ?

Utilisez celui-ci:

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