The location regular matching problem of Nginx

Source: Internet
Author: User
Tags truncated

Reply to discussion (solution)

Rewrite ^/([a-d]) ([a-za-z0-9]{10})/?$/index.php?a=$1&b=$2 last;

Rewrite ^/([a-d]) ([a-za-z0-9]{10})/?$/index.php?a=$1&b=$2 last;



is in the location match, matching to do the forwarding

The following error, can not start
Location ^/([a-d]) ([a-za-z0-9]{10})/?$ {proxy_pass http://127.0.0.1:88/;p roxy_redirect off;proxy_set_header Host Localhost2;proxy_set_header x-real-ip $remote _addr;proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for; Proxy_set_header Referer $http _referer;proxy_set_header Cookie $http _cookie;proxy_connect_timeout 60;proxy_read_ Timeout 600;proxy_send_timeout 600;}

Location ~ ^/([a-d]) ([a-za-z0-9]{10})/?$

Plus, it's a regular match.

What is the error message?
Stick it out ....

Location ~ ^/([a-d]) ([a-za-z0-9]{10})/?$

Plus, it's a regular match.



Or an error, can't start.

Starting Nginx:nginx: [Emerg] Pcre_compile () failed:missing) in "^/([a-d]) ([a-za-z0-9]"

What is the error message?
Stick it out ....



Starting Nginx:nginx: [Emerg] Pcre_compile () failed:missing) in "^/([a-d]) ([a-za-z0-9]"

Missing) in "^/([a-d]) ([a-za-z0-9]"
Truncated on curly braces, estimated to be confused with the following code fragment braces, need to be escaped? Or you can change {10} directly to +
I didn't get this. You see what you need to deal with special symbols

Missing) in "^/([a-d]) ([a-za-z0-9]"
Truncated on curly braces, estimated to be confused with the following code fragment braces, need to be escaped? Or you can change {10} directly to +
I didn't get this. You see what you need to deal with special symbols



Or not.

Location ^/([a-d]) ([a-za-z0-9]+)/?$ {}
I can start on the nginx on my side.

Location ^/([a-d]) ([a-za-z0-9]+)/?$ {}
I can start on the nginx on my side.



You're right, it's me. The code below is wrong.

And finally changed it to "~/[a-d][a-za-z0-9]{10}$."
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.