首页 > nginx 重写的问题

nginx 重写的问题

关于NG重写的疑问

server {

    if (!-e $request_finame) {
        rewrite ^/(.*)  /index.php?$1 last;
    }
    # or
    location / {
        if (!-e $request_finame) {
            rewrite ^/(.*)  /index.php?$1 last;
        }
    }
}

其实我是想问下,两个重写规则是一样的。
但是写在location / 里面,和直接在server下面写。有什么区别。

如果写在外面,www.example.com/packages/xxx.apk 这样是下载不了的。
如果在里面,www.example.com/packages/xxx.apk,只要path存在,是能下载的。

我没能知道原因。请好心人解惑下。谢谢



在一个文章中看到的。
Nginx Rewrite研究笔记


nginx课程

【热门文章】
【热门文章】