Sign up ×
Server Fault is a question and answer site for 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, 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 / {
        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? – user173847 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. – user173847 May 15 '13 at 23:06