i have this URI /orls/myservice/f?p=4550 and the following location

location ~ "^/(.+)/myservice/f?p=(.+)$" {

nginx is returning a 404 not found. the problem might come from the ? so i tried \? buit i'm still getting the same error. Can anyone help ?

  • what exactly you need to match from here: /orls/myservice/f?p=4550 – ADM Apr 8 '15 at 16:36

The location match does not consider the query string:

Note that locations of all types test only a URI part of request line 
without arguments. This is done because arguments in the query string 
may be given in several ways [...]



Try also to escape the / character


  • It's not working nginx does not seem to support ? querry. – skip87 Apr 8 '15 at 16:28

You need to escape slashes and question mark, like this:

location ~ "^\/(.+)\/myservice\/f\?p=(.+)$" {

This will match first folder and p arg.

1 = orls
2 = 4550

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.