NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
GGGG430
V2EX  ›  NGINX

nginx 配置的一个问题

  •  
  •   GGGG430 · Feb 21, 2023 · 2035 views
    This topic created in 1198 days ago, the information mentioned may be changed or developed.

    如题, 有一个 url 为 https://xx.net/visu,

    nginx 配置为 location / { root /opt/path2/admin/dist; index index.html; }

    location ~^/(visu*) { root /opt/path2/visu/dist/; index index.html; }

    此时能正常访问, 但是前端路由会跳转成 https://xx.net/visu/inspection 此时上面的 location 会匹配到 localtion / {} 就很奇怪, 我的正则写的不对吗?

    4 replies    2023-02-21 14:54:41 +08:00
    julyclyde
        1
    julyclyde  
       Feb 21, 2023
    你开 debug 级别日志看看
    296727
        2
    296727  
       Feb 21, 2023   ❤️ 1
    要把子类写到父类上边
    Seanfuck
        3
    Seanfuck  
       Feb 21, 2023
    location ~ ^/visu/ {} 试试
    CopyRight
        4
    CopyRight  
       Feb 21, 2023
    alias /opt/path2/visu/dist/;
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1038 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 18:40 · PVG 02:40 · LAX 11:40 · JFK 14:40
    ♥ Do have faith in what you're doing.