• 请不要在回答技术问题时复制粘贴 AI 生成的内容
whx20202
V2EX  ›  程序员

Nginx 中 location ^~ /lib/ 如果想匹配多个路径怎么办?

  •  
  •   whx20202 · Jan 1, 2017 · 11950 views
    This topic created in 3592 days ago, the information mentioned may be changed or developed.
    是不是非要分开写啊?
    我试过 location ^~ /(lib|images|js)/ 这样的写法好像是不行
    5 replies  •  2017-01-02 18:17:05 +08:00
    j8sec
    j8sec
    Jan 2, 2017 via iPhone
    2
    location ~ ^/(lib|images|js)

    犯这样的错误,自觉发个 5.55¥红包给你女神
    hanyouchun66
    hanyouchun66
    Jan 2, 2017
    3
    location ^~ /(lib|images|js)/
    hanyouchun66
    hanyouchun66
    Jan 2, 2017❤️1
    4
    一不小心发错了~
    location ^~ /(lib|images|js)/
    不是正则匹配.
    正则匹配只有 ~ ~*
    因此要这么写
    location ~ ^/(lib|images|js)
    whx20202
    whx20202
    OP
    Jan 2, 2017
    5
    感谢~
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5070 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 07:36 · PVG 15:36 · LAX 23:36 · JFK 02:36
    ♥ Do have faith in what you're doing.