2015-07-13 49 views
0

我不知道爲什麼,但我得到一個404的時候都給我打我的網頁,這是我改寫:Nginx的重寫是給404

rewrite ^dashboard/(.+)$ /dashboard/index.html?path=$1; 

作品:

/dashboard/ 

隱而不宣」 t工作(給404):

/dashboard/page1 
/dashboard/page2 

我的重寫有什麼問題嗎?

這裏是我的服務器上的文件,該rewriteinclude

server{ 
    listen 80; 

    server_name cleep.us www.cleep.us; 
    root   /usr/share/nginx/html/cleep.us/public; 
    index   index.html index.php; 

    location/{ 
     try_files $uri $uri/ index.html; 
     include /usr/share/nginx/conf/cleep.us.conf; 
    } 
} 

錯誤日誌來自:

2015年7月13日1點53分00秒[錯誤] 14712#0: * 9613 open()「/usr/share/nginx/html/cleep.us/publicindex.html」failed(2:No such file or directory),client:24.197.220.192,server:cleep.us,request:「GET/dashboard/clicks HTTP/1.1「,主機:」cleep.us「

+0

你可以包含'nginx'的錯誤日誌嗎? – uzsolt

+0

添加了它,看起來好像它不會放過斜線或什麼 –

回答

1

看起來這是什麼將解決我的問題,它現在的作品。如果有更好的方法,請讓我知道。

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

location /dashboard { 
    try_files $uri $uri/ /dashboard/index.html; 
    include /usr/share/nginx/conf/cleep.us.conf; 
}