Nginx location regular match Problem reply 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;
It is matched in location and matched to forward
The following error is reported and cannot be started.
location ^/([A-D])([a-zA-Z0-9]{10})/?$ {proxy_pass http://127.0.0.1:88/;proxy_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 })/? $
Add ~ That is, regular expression matching.
What is the error message?
Paste it ....
Location ~ ^/([A-D]) ([a-zA-Z0-9] {10 })/? $
Add ~ That is, regular expression matching.
Or an error is reported, but it cannot be started.
Starting nginx: [emerg] pcre_compile () failed: missing) in "^/([A-D]) ([a-zA-Z0-9]"
What is the error message?
Paste it ....
Starting nginx: [emerg] pcre_compile () failed: missing) in "^/([A-D]) ([a-zA-Z0-9]"
Missing) in "^/([A-D]) ([a-zA-Z0-9]"
It is truncated on the braces. it is estimated that it is confused with the braces of the subsequent code segments. do you need to escape them? Or you can replace {10} with + directly.
I have never done this... you can see what special symbols need to be processed.
Missing) in "^/([A-D]) ([a-zA-Z0-9]"
It is truncated on the braces. it is estimated that it is confused with the braces of the subsequent code segments. do you need to escape them? Or you can replace {10} with + directly.
I have never done this... you can see what special symbols need to be processed.
No.
Location ^/([A-D]) ([a-zA-Z0-9] + )/? $ {}
I can start nginx on my side.
Location ^/([A-D]) ([a-zA-Z0-9] + )/? $ {}
I can start nginx on my side.
You are right. the code below my location is wrong.
Finally, I changed it "~ /[A-D] [a-zA-Z0-9] {10} $"