Forum: NGINX Can these rules be ported easily to nginx?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
47448045581d60b3884fb47da28dd362?d=identicon&s=25 Shri @ DevLib.Org (Guest)
on 2008-12-28 19:25
(Received via mailing list)
I'm considering migrating an ecommerce site that we run, to nginx.

The default rules that we have in Apache, look fairly complex and I'd
like to seek some guidance to see if they can be migrated to Ngix 0.7.27
or somewhere close to that.

1) RedirectMatch gone:

# block all smarty templates (no reason to have these exposed)
RedirectMatch gone ^/.*\.tpl$

2) Complex RewriteRules. These just work under Apache and while I've had
sucess in several instances with nginx by replacing RewriteRule with
rewrite and the [QSA,L] with last, I'd like to see if anyone spots
anything obvious.

RewriteRule
^([^/]*/)?[^/]+-printable-(productcode|title|price|orderby)-up-c-([0-9]+)-p-([0-9]+)\.html$
$1home.php?printable=Y&sort=$2&sort_direction=0&cat=$3&page=$4 [QSA,L]
RewriteRule
^([^/]*/)?[^/]+-printable-(productcode|title|price|orderby)-down-c-([0-9]+)-p-([0-9]+)\.html$
$1home.php?printable=Y&sort=$2&sort_direction=1&cat=$3&page=$4 [QSA,L]

Regards,
Shri
B9340b8cfd6b4038536e58327ef648c9?d=identicon&s=25 Arvind Jayaprakash (Guest)
on 2008-12-30 18:17
(Received via mailing list)
Shri @ DevLib.Org wrote:
> I'm considering migrating an ecommerce site that we run, to nginx.
>
> The default rules that we have in Apache, look fairly complex and I'd
> like to seek some guidance to see if they can be migrated to Ngix 0.7.27
> or somewhere close to that.
>
> 1) RedirectMatch gone:
>
> # block all smarty templates (no reason to have these exposed)
> RedirectMatch gone ^/.*\.tpl$

This sounds like a location block with a custom status


> $1home.php?printable=Y&sort=$2&sort_direction=1&cat=$3&page=$4 [QSA,L]
The rules are not complex; just the regex is :)
Read it as:
some_regex new_url [QSA,L]

QSA always happens in nginx.
L corresponds to last
http://wiki.codemongers.com/NginxHttpRewriteModule#rewrite
This topic is locked and can not be replied to.