Define a proxy for Nginx

Jonathan Matthews contact at
Mon Nov 4 14:01:39 UTC 2013

On 4 November 2013 13:00, odesport <nginx-forum at> wrote:
> Hello,
> My Nginx servers are behind a proxy. Some PHP apps need to reach external
> web sites (for RSS feeds for example). I've tried this in nginx.conf :
> env http_proxy=http://myproxy:port
> but there is no effect.
> How can I define a proxy for nginx ?

I don't know the answer to that specific question, but I believe
you're asking the /wrong/ question :-)

Nginx doesn't execute your PHP, it just passes the requests to another
process. Your PHP apps will be executing in the context of this
different process (such as php-fpm) and it is /that/ process which you
need to inform about an outbound HTTP proxy. The specifics of how you
do that will depend on which process you've chosen to contain your
PHP, and the way in which your PHP makes outbound HTTP calls.

Jonathan Matthews
Oxford, London, UK

More information about the nginx mailing list