Nginx的重写是给404

问题描述:

我不知道为什么,但我得到一个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

添加了它,看起来好像它不会放过斜线或什么 –

看起来这是什么将解决我的问题,它现在的作品。如果有更好的方法,请让我知道。

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

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