Py学习  »  NGINX

位置匹配后nginx重写

Simon55 • 6 年前 • 939 次点击  

我对nginx很陌生,只是想做一些我认为应该很简单的事情。如果我这样做了:

卷曲 http://localhost:8008/12345678

我希望返回index.html页面。但我却找不到404。/usr/share/nginx/html/12345678没有这样的文件

如果我卷曲 http://localhost:8008/ 我希望请求被传送到 http://someotherplace/ 但是我找到了302,就这样。

对基本问题表示歉意,但希望能得到一些建议!

这是代码:

server {
    listen 8008;
    server_name default_server;

    location / {
       rewrite ^/$ http://someotherplace/ redirect;
    }

    location ~ "^/[\d]{8}" {
       rewrite ^/$ /index.html;
       root /usr/share/nginx/html;
    }
}
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/40088
文章 [ 2 ]  |  最新文章 6 年前