Welcome! Log In Create A New Profile

Advanced

Re: Nginx Rewrite Apache?

Francis Daly
April 11, 2011 06:16PM
On Mon, Apr 11, 2011 at 05:59:01PM -0400, Adrian Janeczek wrote:

Hi there,

> dosen't work
> http://s1.rapidox.pl/QJNqq0821sxz7200DAp0/Si.s_sred.iowi.cze.part5.rar
>
> http://s1.rapidox.pl/files/Si.s_sred.iowi.cze.part5.rar
>
> rewrite >
> rewrite "^[A-Z]{3}[a-z]{2}\d{4}[a-z]{3}\d{4}[A-Z]{2}[a-z]\d/(.+)$"
> files/$1;

The nginx debug log is usually good.

In this case, you would see something like

"^[A-Z]{3}[a-z]{2}\d{4}[a-z]{3}\d{4}[A-Z]{2}[a-z]\d/(.+)$" does not match "/QJNqq0821sxz7200DAp0/Si.s_sred.iowi.cze.part5.rar", client: 127.0.0.1, server: , request: "GET /QJNqq0821sxz7200DAp0/Si.s_sred.iowi.cze.part5.rar

In nginx, the request starts with "/", so if you use "^", the next
character must match "/" or the regex won't match.

> i trying this but not work...
> rewrite "([A-Z] {3})([a-z] {2})([0-9] {4})([a-z] {3})([0-9] {4})([A-Z]
> {2})([a-z] {1})([0-9] {1})/(.+)$" /files/$1 last;

This fails to match because the spaces should not be there. The example on
the wiki should probably be fixed, if someone already has a login there?

If you erase the spaces, then the regex does match, but the replacement
$1 is "QJN", because of the parentheses.

Your original rewrite line wrapped in double quotes should work, with
the initial "^" changed to "^/" (and the replacement "files" becoming
"/files".

Good luck with it,

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx Rewrite Apache?

Adrian Janeczek April 11, 2011 05:19PM

Re: Nginx Rewrite Apache?

António P. P. Almeida April 11, 2011 05:34PM

Re: Nginx Rewrite Apache?

Steve April 11, 2011 05:38PM

Re: Nginx Rewrite Apache?

Adrian Janeczek April 11, 2011 05:48PM

Re: Nginx Rewrite Apache?

Adrian Janeczek April 11, 2011 05:50PM

Re: Nginx Rewrite Apache?

Adrian Janeczek April 11, 2011 05:59PM

Re: Nginx Rewrite Apache?

Steve April 11, 2011 06:10PM

Re: Nginx Rewrite Apache?

Adrian Janeczek April 11, 2011 06:15PM

Re: Nginx Rewrite Apache?

Adrian Janeczek April 11, 2011 06:47PM

Re: Nginx Rewrite Apache?

António P. P. Almeida April 11, 2011 06:14PM

Re: Nginx Rewrite Apache?

Francis Daly April 11, 2011 06:16PM

Re: Nginx Rewrite Apache?

António P. P. Almeida April 11, 2011 06:24PM

Re: Nginx Rewrite Apache?

António P. P. Almeida April 11, 2011 05:52PM

Re: Nginx Rewrite Apache?

Adrian Janeczek April 15, 2011 05:36PM

Re: Nginx Rewrite Apache?

Francis Daly April 18, 2011 08:00AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 298
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready