nginx - regular expression matching route writing method
阿神
阿神 2017-05-16 17:26:42
0
1
738

If you want to match some regular routes, use a proxy

location /chat/ {
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header  X-Real-IP  $remote_addr;
        proxy_pass http://newmessage;
 }

I want all routes starting with /chat/ to be proxied, such as /chat/send/. The above way of writing will work.

But want to add multiple matches

location /chat/ or /a/ or /b/ {

I checked some information online

location /(chat|a|b)/ {

This doesn't work either.

阿神
阿神

闭关修行中......

reply all(1)
phpcn_u1582

Add a tilde

location ~ /(chat|a|b)/ {
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!