How to: Use NginX as a Forward Proxy server
Generally people use NginX as a Reverse Proxy server, which is what it was designed for. However, after working with NginX for sometime now, I realized conceptually a proxy server could work both ways, right? The thought is an interesting one but its market might be limited. You could leverage the caching mechanism to provide a faster experience to users or as a method to bypass firewalls potentially. I generally don’t think public proxy servers are safe as it is rather easy to intercept your information but hosting your own addresses that issue. At this point you are probably thinking… why not simply install a system that is truly developed as a forward proxy server like http://www.privoxy.org/? Well, you got me! I am mostly doing this because I already have a WebCaching NginX server I could easily turn into a forward proxy. I really don’t feel like having another piece of software on my stack I need to learn and understand. So if you are in the same boat that you want to have NginX go both ways then read on!
If you have used NginX as a Reverse proxy this is going to be really simple and straight forward. The only difference now is going to be you using an actual public web server as the upstream server. If you haven’t worked with NginX as a proxy server, fear not, it is rather simple once you get the hang of it.
In general people use a proxy server to access sites that their network might be blocking… or if you host a server in a particular country you might get access to content that is not available in your country (think Pandora, Netflix, etc).
I. Add a Server Block to accept connections for the sites you want to forward proxy to: