zope/plone cache rewrite rules?

Aleksandar Lazic al-nginx at none.at
Tue Jan 1 15:14:40 MSK 2008


On Mon 31.12.2008 15:45, Alexis Torres Garnica wrote:
> Hi guys, I have problems porting this apache mod_rewrite rules to
> nginx rewrite rules, I have a zope server who talk with squid
> (configured like a reverse proxy), infront the squi we have apache2,
> the arch is this:
> people -> request -> apache -> squid -> zope
> we wanna replace apache with nginx, the actual apache rewrite rules
> are this for http://domain/ultimas:
>RewriteRule ^/ultimas(.*)/$
>{SERVER_NAME}/80/ultimas$1 [L,P]
>RewriteRule ^/ultimas(.*) 
>{SERVER_NAME}/80/ultimas$1 [L,P]

You need at least 0.6.18 so that you can use variales in proxy_pass.
You should take a look into 


I would try this:

location ^/ultimas(.*) {



> This is for the virtual host called migarcion
>RewriteCond %{REQUEST_FILENAME}  .*jpg$|.*gif$|.*png$ [NC]
>RewriteCond %{HTTP_REFERER}  !^$
>RewriteCond %{HTTP_REFERER}  !migracion\.jornada\.unam\.mx [NC]
>RewriteRule ([0-9]{4})/([0-9]{2})/([0-9]{2})/?(.*) 
>   http://%{SERVER_NAME}/showpic.php?pic=$1/$2/$3/$4  [L]


location ~* \.(gif|jpg|png)$ {

   valid_referers migracion.jornada.unam.mx;
   if ($invalid_referer){
     return 403;

   if($request_uri ~ "([0-9]{4})/([0-9]{2})/([0-9]{2})/?(.*)" ){
     # for this I'am not sure
     proxy_pass http://${http_host}/showpic.php?pic=$1/$2/$3/$4;

> This is for one virtual host called ciencias
> RewriteCond %{REQUEST_FILENAME}  .*jpg$|.*gif$|.*png$ [NC]
> RewriteCond %{HTTP_REFERER}  !^$
> RewriteCond %{HTTP_REFERER}  !ciencia\.jornada\.unam\.mx [NC]
> RewriteRule ([0-9]{4})/([0-9]{2})/([0-9]{2})/?(.*) 
> http://%{SERVER_NAME}/showpic.php?pic=$1/$2/$3/$4  [L]

Similar the the up one, only with diff referer host ;-).



More information about the nginx mailing list