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.

This question already has an answer here:

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.

share|improve this question

marked as duplicate by Michael Hampton, mdpc, Dave M, gWaldo, Ward May 16 '13 at 2:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 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.

share|improve this answer
    
It works as a forward proxy, what's wrong with using it as one? –  danielcg 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. I only need to make it so that it requires a username and password. –  danielcg May 15 '13 at 23:06

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