2010-04-15 65 views
2

我想nginx服務從網站根(:http://localhost:8080/)的靜態文件,但它服務我的代理通行證;它服務於「/」規則而不是「= /」。nginx規則來服務根

這裏是我的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/; 
} 

我錯過了什麼?

回答

3

使用這一個:

location =/{ 
    index index.html; 
} 

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