Rewritemap in nginx

Igor Sysoev is at rambler-co.ru
Sat Oct 4 00:45:49 MSD 2008


On Fri, Oct 03, 2008 at 08:52:48PM +0200, Klaas Naaijkens wrote:

> I am trying to implement the RewriteMap funcionality I am using
> extensively in apache in some way with nginx.
> 
> In apache we use a dbm database where we store legacy urls (around
> 100.000) that we redirect to their new urls.
> 
> We have
> RewriteMap oldlinks dbm:/etc/apache2/oldlinks.dbm
> RewriteCond %{REQUEST_URI}                  \.php$
>                  [NC]
> RewriteCond %{HTTP_HOST}                    ^(www)?([^.]+)\.
>                 [NC]
> RewriteCond ${lowercase:%2}$1               ^(.*)$
> RewriteCond ${oldlinks:%1|NONE}             ^(http://.*)$
> RewriteRule ^(.*php)$                       %1
>                  [NC,R=301,L]
> 
> Now I am trying to reimplement this functionality in the nginx. I have
> tried to create a text file with my mappings and use
> NginxHttpMapModule but so far without success.
> 
> I get these messages
> Starting nginx: 2008/10/03 20:31:58 [emerg] 22017#0: could not build
> the map_hash, you should increase either map_hash_max_size: 102400 or
> map_hash_bucket_size: 128
> I can keep increase the sizes but at a certain point nginx doesn't
> even start up any more.

It seems that nginx starts, but run too long. What does top show at start ?

You may try

http {
    map_hash_bucket_size  1024;
    map_hash_max_size     102400;


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list