1

它应该如何工作

  1. 前端起始页是http://server/apex/- 死页
  2. 重定向到工作页面,to /apex/f?p=100:4:0::NO:::
  3. 制作干净的网址类型 http://server/apex/4/0/NO

location / {

   proxy_pass http://127.0.0.1:8080;
    include /etc/nginx/reverse_proxy.conf;
    rewrite ^/$ /apex/f?p=100:4:0::NO:::? permanent;
       }

location  /apex {
    proxy_pass http://127.0.0.1:8080;
    include /etc/nginx/reverse_proxy.conf;

    if ($args ~ "p=100:(.*):(.*)::(.*):::") {
                  set $args $1/$2/$3/$4;
                  rewrite ^/[a-z]+/.+ /apex/$args?;
                              }
        }

从 nginx 登录 - access.log ”

GET / HTTP/1.1" 301 178 "-"
"GET /apex/f?p=100:4:0::NO::: HTTP/1.1" 404 5 

来自错误日志(调试)

[notice] 27639#0: *3 "^/$" matches "/", client: 222.222.222.222, server: server, request: "GET / HTTP/1.1", host: "server"
 [notice] 27639#0: *3 rewritten redirect: "/apex/f?p=100:4:0::NO:::", client: 222.222.222.222, server: server, request: "GET / HTTP/1.1", host: "server"
 [notice] 27639#0: *3 "p=100:(.*):(.*)::(.*):::" matches "p=100:4:0::NO:::", client: 222.222.222.222, server: server, request: "GET /apex/f?p=100:4:0::NO::: HTTP/1.1", host: "server"
 [notice] 27639#0: *3 "^/[a-z]+/.+" matches "/apex/f", client: 222.222.222.222, server: server, request: "GET /apex/f?p=100:4:0::NO::: HTTP/1.1", host: "server"
 [notice] 27639#0: *3 rewritten data: "/apex/4/0/NO", args: "", client: 222.222.222.222, server: server, request: "GET /apex/f?p=100:4:0::NO::: HTTP/1.1", host: "server"
 [notice] 27639#0: *3 "p=100:(.*):(.*)::(.*):::" does not match "", client: 222.222.222.222, server: server, request: "GET /apex/f?p=100:4:0::NO::: HTTP/1.1", host: "server"

我究竟做错了什么?

4

0 回答 0