2017-08-29 106 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; 
} 

你的缺省路徑和/開始。所以不要錯過在靜態文件路徑中