V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
bztwh
V2EX  ›  NGINX

nginx 正则问题

  •  
  •   bztwh · Mar 4, 2020 · 1832 views
    This topic created in 2245 days ago, the information mentioned may be changed or developed.

    location 配置

    location /test/page/ {
        alias C:/test/html/;
        index  index.html index.htm;
    }
    location /test/page1/ {
        alias C:/test/html/;
        index  index.html index.htm;
    }
    

    192.168.2.100:8000/test/page/ 192.168.2.100:8000/test/page1/ 都可以正常访问

    location 配置

    location ~ /test/page(\d+)/ {
        alias C:/test/html/;
        index  index.html index.htm;
    }
    

    访问 192.168.2.100:8000/test/page1/ 地址就会变成 192.168.2.100:8000/test/page1/index.html/index.html/index.html/index.html/index.html/...

    求教这里应该如何配置

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4491 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 00:09 · PVG 08:09 · LAX 17:09 · JFK 20:09
    ♥ Do have faith in what you're doing.