Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

4 Answers 4

up vote 5 down vote accepted

Actually you CAN use nginx as a transparent proxy

http://pastebin.com/BDt2fXxF

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 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. serverfault.com/questions/298392/… –  sciurus Jul 16 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 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
    
Not to RTFM you, but in the FAQ is an answer on how to enable Forward-Proxy Mode (cwiki.apache.org/confluence/display/TS/FAQ#FAQ-forwardproxy) , and of course is the Administrator's Guide (trafficserver.apache.org/docs/v2/admin) –  gWaldo Sep 15 '11 at 12:54
2  
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
2  
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 (catb.org/~esr/faqs/smart-questions.html) will take you far in life. –  gWaldo Sep 16 '11 at 18:08
1  
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

 
discard

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.