zope/plone cache rewrite rules?

Kenneth Demanawa kdemanawa at gmail.com
Tue Jan 8 19:28:04 MSK 2008


hi aleks.

this is untested but maybe you can try something like this:

....
#just outside your server, define squid as your upstream
upstream squid {
  server 132.247.1.32:8080;
}
#vhost
server {
   listen 80;
    #...snip
   location /ultimas {
     # rewrite the incoming uri
     rewrite (*.) http/$host/80/ultima$ break;
     proxy_pass http://squid;
  }
}


--kenneth

On Jan 8, 2008 11:59 PM, Alexis Torres Garnica <gaper at jornada.com.mx> wrote:
> Tnks for your answer Aleksandar Lazic, I was slow to respond because a
> problem in the squid configuration, Im trying this configuration based
> in your:
>
>         location /ultimas/ {
>                 #proxy_pass
> http://132.247.1.32:8080/http/www.jornada.unam.mx/80/ultimas;
>                 #proxy_pass
> http://132.247.1.32:8080/http/${http_host}/80/ultimas;
>                 #proxy_pass
> http://132.247.1.32:8080/http/132.248.10.56/80/ultimas;
>                 #proxy_pass
> http://132.247.1.32:8080/http/impresa.jornada.com.mx/80/ultimas;
>                 #proxy_pass
> http://132.247.1.32:8080/http/www.jornada.unam.mx/ultimas;
>                 #proxy_pass
> http://132.247.1.32:8080/http/${http_host}/ultimas;
>                 #proxy_pass
> http://132.247.1.32:8080/http/132.248.10.56/ultimas;
>                 proxy_pass
> http://132.247.1.32:8080/http/impresa.jornada.com.mx/ultimas;
>         }
>
> in each case I just get this if I do
> http://impresa.jornada.com.mx:81/ultimas/
>
> The requested URL could not be retrieved
>
> While trying to retrieve the URL: http://denypool/denyme
>
> The following error was encountered:
>
>     Unable to determine IP address from host name for denypool
>
> The dnsserver returned:
>
>     Name Error: The domain name does not exist.
>
> This means that:
>
>  The cache was not able to resolve the hostname presented in the URL.
>  Check if the address is correct.
>
> Your cache administrator is webmaster at jornada.com.mx.
> Generated Fri, 04 Jan 2008 20:05:22 GMT by squidtest.jornada.unam.mx
> (squid/2.5.STABLE14)
>
> last question Aleksandar, why do you removed the /80/ in the rule?
>
> tnks for your help :D and nice week end for all guys =).
>
> ----------------------------------------------------------------------------------------------------------------------------------------------
> Aleksandar Lazic escribió:
>  > Hi,
>  >
>  > 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(.*)/$
>  >>        http://127.0.0.1:8080/http/%{SERVER_NAME}/80/ultimas$1 [L,P]
>  >> RewriteRule ^/ultimas(.*)
> http://127.0.0.1:8080/http/%{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
>  > http://wiki.codemongers.com/NginxHttpCoreModule#location
>  > http://wiki.codemongers.com/NginxHttpProxyModule#proxy_pass
>  >
>  > I would try this:
>  >
>  > location ^/ultimas(.*) {
>  >
>  >   proxy_pass http://127.0.0.1:8080/http/${http_host}/ultimas$1;
>  >
>  > }
>  >
>  >> 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]
>  >
>  > http://wiki.codemongers.com/NginxHttpRefererModule
>  >
>  > 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 ;-).
>  >
>  > Hth
>  >
>  > Aleks
>
>





More information about the nginx mailing list