现在的位置: 首页 > 综合 > 正文

Nginx在URL末尾添加/

2013年04月17日 ⁄ 综合 ⁄ 共 241字 ⁄ 字号 评论关闭

我的网站中有一个/viewer/index.html页面,必须访问时使用/, 但是用户通常不会手动添加/,所以在Nginx配置中添加一个rewrite命令。

下面的例子是一个例子:

    location /viewer/ {
        rewrite ^([^.]*[^/])$ $1/ permanent;
        proxy_pass http://localhost:88/viewer/;
        proxy_set_header Host      $host;
        proxy_set_header X-Real-IP $remote_addr;
    }

抱歉!评论已关闭.