# Nginx as a reverse proxy, forwarding to a squid proxy server

**URL:** <https://www.ruby-forum.com/t/nginx-as-a-reverse-proxy-forwarding-to-a-squid-proxy-server/201559>\
**Category:** NGINX\
**Created:** [January 10, 2011, 7:11pm UTC](https://www.ruby-forum.com/t/nginx-as-a-reverse-proxy-forwarding-to-a-squid-proxy-server/201559 "2011-01-10T19:11:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 10, 2011, 7:11pm UTC](https://www.ruby-forum.com/t/nginx-as-a-reverse-proxy-forwarding-to-a-squid-proxy-server/201559/1 "2011-01-10T19:11:01Z")

</div>

Greetings all,

Was wondering if it is possible to configure nginx as a reverse proxy  
that forwards to a squid proxy server.

Currently I am using Squid as a forward proxy to another internal Squid  
proxy server:  
cache\_peer internal\_squid\_proxy parent 8000 0 no-query  
cache\_peer\_access internal\_system allow internal\_squid\_proxy https

I’ve looked at the reverse proxy SSL write up here:  
[http://www.cyberciti.biz/faq/howto-linux-unix-setup-nginx-ssl-proxy/](http://www.cyberciti.biz/faq/howto-linux-unix-setup-nginx-ssl-proxy/)

That looks pretty close to what I want to do, except instead of  
reversing directly to a web server, I need to reverse to a forward  
proxy.

Ie, something like:  
location / {  
proxy\_pass http://internal\_squid\_proxy;  
}

Is there a cache\_peer equivalent (instead of proxy\_pass) for nginx?

Thank you,

Robert

Posted at Nginx Forum:

> **[nginx as a reverse proxy, forwarding to a squid proxy server](https://forum.nginx.org/read.php?2,165168,165168#msg-165168)**
>
> Greetings all, Was wondering if it is possible to configure nginx as a reverse proxy that forwards to a squid proxy server. Currently I am using Squid as a forward proxy to another internal Squid proxy server: cache\_peer internal\_squid\_proxy parent...

---

<div class="post-metadata">

**Author:** ![robertelee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/2acd7d/32.png) [@robertelee](https://www.ruby-forum.com/u/robertelee)\
**Post date:** [January 11, 2011, 4:38pm UTC](https://www.ruby-forum.com/t/nginx-as-a-reverse-proxy-forwarding-to-a-squid-proxy-server/201559/2 "2011-01-11T16:38:42Z")

</div>

On Jan 10, 2011, at 11:21 PM, Vivek Gite wrote:  
You can connect directly to your proxy server and proxy will connect  
to Apache backend.

=-=-=-=-=-=

Perhaps I’m asking the question in the wrong way.

I got nginx to send connections to the internal squid server, but it’s  
treating it like a normal web server instead of an HTTP proxy. How can I  
get nginx to use the proxy as a proxy, instead of a web server?

So when I visit the nginx server, I just get:  
ERROR

The requested URL could not be retrieved

While trying to retrieve the URL: /

The following error was encountered:

Invalid URL  
Some aspect of the requested URL is incorrect. Possible problems:

Missing or incorrect access protocol (should be `http://‘’ or similar)  
Missing hostname  
Illegal double-escape in the URL-Path  
Illegal character in hostname; underscores are not allowed  
Your cache administrator is webmaster.

Generated Mon, 10 Jan 2011 21:31:07 GMT by internal\_squid\_server  
(squid/3.0.STABLE12)

Posted at Nginx Forum:

> **[Re: nginx as a reverse proxy, forwarding to a squid proxy server](https://forum.nginx.org/read.php?2,165168,165350#msg-165350)**
>
> Greetings all, Was wondering if it is possible to configure nginx as a reverse proxy that forwards to a squid proxy server. Currently I am using Squid as a forward proxy to another internal Squid proxy server: cache\_peer internal\_squid\_proxy parent...
