2017-08-29 84 views
0

你好我得到404附加文件名,而尝试使用nginx的nginx的根目录

这里提供静态内容就是我的nginx的conf文件

server { 
    listen  80; 
    server_name uat.mygymchum.com; 
    root /home/rc/gymchum-uat/dist; 
    index index.html index.htm; 
    location/{ 
     try_files $uri $uri/ index.html; 
    } 
    error_page 404 =200 index.html; 

    # redirect server error pages to the static page /50x.html 
    #error_page 500 502 503 504 /50x.html; 
    #location = /50x.html { 
    # root html; 
    #} 
} 

当我看到的error.log文件,我可以看到这个错误。

2017/08/29 17:38:24 [error] 19404#19404: *2 open() "/home/rc/gymchum-uat/distindex.html" failed (2: No such file or directory), client: 123.201.181.85, server: uat.mygymchum.com, request: "GET/HTTP/1.1", host: "uat.mygymchum.com" 

回答

0

尝试改变

location/{ 
    try_files $uri $uri/ index.html; 
} 

location/{ 
    try_files $uri $uri/ /index.html; 
} 

你的缺省路径和/开始。所以不要错过在静态文件路径中