0

Right now I have a proxy set up at MyDomain.com:8080, but I'd like to have it secured.

To get this proxy setup I added this to my nginx config file:

server {
    listen       8080;

    location / {
        resolver 8.8.8.8;
        proxy_pass http://$http_host$uri$is_args$args;
    }

I tried searching but only came up with results for a /reverse/ proxy. I need a regular one.

1 Answers1

1

nginx makes a great reverse proxy, but is less than ideal as a forward proxy. It can be done, but since writing the rules you want will be rather hairy, you're almost certainly better off to use a purpose-built forward proxy, such as squid. Doing so also means your future self will have a much better chance of understanding what's going on when trying to maintain or debug the proxy.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • It works as a forward proxy, what's wrong with using it as one? –  May 15 '13 at 22:26
  • If that were actually true, there would be nothing wrong with it. – Michael Hampton May 15 '13 at 22:27
  • It /is/ true! I have a proxy setup on my VPS using only Nginx at this very moment. I used parts of [this](http://ef.gy/using-nginx-as-a-proxy-server). I only need to make it so that it requires a username and password. –  May 15 '13 at 23:06