Replacing apache with nginx

Maxim Dounin mdounin at mdounin.ru
Wed Oct 1 01:02:24 MSD 2008


Hello!

On Tue, Sep 30, 2008 at 11:36:06PM +0300, Gena Makhomed wrote:

>On Tuesday, September 30, 2008 at 22:41:03, Stephen Nelson-Smith wrote:
>
>SNS> redirects -everything- *apart from* http://www.example.com/xml,
>SNS> which should be allowed to proceed as http only.
>
>server {
>    listen 443;
>    server_name www.example.com;
>
>    location = /xml {
>        return 403;
>    }
>    
>    location / {
>        proxy_pass http://backend;
>    }
>}
>
>server {
>    listen 80;
>    server_name www.example.com;
>    
>    location = /xml {

I believe the original regex from apache's config was 
prefix-match, so '=' should be removed. 

>        proxy_pass http://backend;
>    }
>    
>    location / {

-        rewrite ^ https://www.example.com$request_uri permanent;
+        rewrite ^ https://www.example.com$request_uri? permanent;

Since $request_uri already includes query string, it's important 
to add '?' to prevent duplication of query string.

>    }
>}

Maxim Dounin





More information about the nginx mailing list