Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Looking to implement an office network with peak # users of 40-50 people and clients and I'm thinking that nginx could be used as a transparent proxy to cache requests to any HTTP-based site at the edge of the network. Is this possible? And if so, how?

I have tried googling and searching but it seems that all resources seem to point at hosting your own servers and caching requests to those. However, we will also be hosting servers in this network, so nginx will be used to route requests to those as well.

So: how do I set up nginx as a transparent proxy for requests to internet servers, in a way that can also proxy calls to our web servers?

share|improve this question
up vote 6 down vote accepted

Actually you CAN use nginx as a transparent proxy

We are using nginx as proxy in my company since about 10 minutes and it's working perfect up to now (I'll see how to enable caching later).

share|improve this answer

Squid would be a better choice listening on the normal port and redirecting by your favorite firewall.

Network ---> Firewall listening on port 80 forwarding to 3128 (Squid)

share|improve this answer

You can't do this. Nginx is a reverse proxy, and what you a describing is a forward proxy. Squid or Polipo are examples of these (although Squid can also be used as a reverse proxy).

share|improve this answer
You can use nginx as a forward proxy - but it is not as full-featured as something like Squid. – thomasrutter Jul 15 '14 at 4:45
I was surprised to hear that, but it looks like with some hacks you can use it as a forward proxy. Of course, like the first answer states you wouldn't actually want to.… – sciurus Jul 16 '14 at 13:19
Its support for caching is poor, and it does not support proxying of HTTPS (ie, the CONNECT method). It supports just enough proxying features to make it useful as a reverse proxy, and the fact it works as a forward proxy at all is just a bonus. – thomasrutter Jul 16 '14 at 23:44

Apache Traffic Server can serve as both a forward- and reverse-proxy. You can listen to an interview with the project on FLOSS Weekly #179 (where they quickly dismiss Squid as being old and slow.)

Given the size of your environment, you probably don't need a hierarchal cache; you'll probably be fine with a single HTTP Proxy Cache.

share|improve this answer
So how do I go about setting that up for my use-case? – Henrik Sep 15 '11 at 10:32
It seems my comment was deleted. My point is that I don't like "RTFM-answers", in fact I spit on them. Anyway, I like your answer as such, but it could be made much better by describing e.g. a direction to take. So you are correct in your above assumptions, but everyone starts at some point and I'm here asking for help. I look at the site and there seems to be many options to choose from - for example, am I looking for a web proxy or for a cache hierarchy proxy? – Henrik Sep 16 '11 at 13:59
I dislike giving RTFM answers, but only you know your environment well enough to make decisions that impact it. I have pointed out to you another product that may fill the need that you have, but it is your responsibility to do the research into it. Being that you are a Systems Professional, it is expected that you do your due diligence before asking questions. In this instance, if you don't know whether to use a web versus a cache hierarchy proxy, I would submit another question to SF focused on that. – gWaldo Sep 16 '11 at 17:47
I'm not entirely sure that you understand what to expect from this community. If you wanted "best practices", then your question should have been asking for 'a list of best-practices'. (Ask for what you want; we're not psychic.) But honestly, that kind of thing is a search away. If you have attempted to do research, you should say what turned up and why you weren't satisfied with it. Reading Eric S. Raymond's post on Asking Questions ( will take you far in life. – gWaldo Sep 16 '11 at 18:08
And do try not to get upset when people don't give you exactly what you want. "Spitting on" answers is not helpful to anyone, and is disrespectful to people who are volunteering time and effort to help one-another. That attitude (and the cursing) was what got your comment flagged and removed. – gWaldo Sep 16 '11 at 18:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.