Reverse Proxy with caching

infestdead nginx-forum at nginx.us
Fri Oct 30 14:08:25 MSK 2009


infestdead Wrote:
-------------------------------------------------------
> Igor Sysoev Wrote:
> --------------------------------------------------
> > 
> >     location ~ \.php$ {
> >         proxy_pass           http://backend;
> >     }
> > 
> 
> When I try using proxy_pass within location ~
> something I get :
> : "proxy_pass" may not have URI part in location
> given by regular expression, or inside named
> location, or inside the "if" statement, or inside
> the "limit_except" block in
> /etc/nginx/nginx.conf:52
> 
> the line is proxy_pass http://127.0.0.1:8080/;
> 
> Do you have an idea what the problem might be?
> 
> Thanks,
> Ivo
> 

Hm I found out what the problem was,
You cant have proxy_pass http://ip:port if you have a regexp in the location directive, if you do - you need to define upstream first :
upstream php_server {
   server http://ip:port/;
}
and then
proxy_pass http://php_server;

That did it for me.
Cheers,
Ivo

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,13955,18230#msg-18230






More information about the nginx mailing list