Nginx Load Balancing Two Squid Forward Proxyies

Hi everyone,

I’m trying to get nginx to work as a load balancer for 2 squid forward
proxies. I’m running nginx 1.6.2 on a Centos 7 64bit machine. Here’s my
config:

Nginx.conf:

user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {

    upstream HD {
    server xxx.xxx.xxx.xxx:8080;
    server xxx.xxx.xxx.xxx:8080 backup;
    }
include       /etc/nginx/mime.types;
default_type  application/octet-stream;

log_format  main  '$remote_addr - $remote_user [$time_local] 

“$request” ’
'$status $body_bytes_sent “$http_referer” ’
‘"$http_user_agent" “$http_x_forwarded_for”’;

access_log  /var/log/nginx/access.log  main;

sendfile        on;
#tcp_nopush     on;

keepalive_timeout  65;

#gzip  on;

include /etc/nginx/conf.d/*.conf;

}

My conf.d/default.conf

server {
listen 8080;
server_name localname.localdomain.de;

#charset koi8-r;
#access_log  /var/log/nginx/log/host.access.log  main;

location / {
    proxy_pass http://HD;
    }

}

I’m using my nginx in the proxy settings of my internet explorer and try
to visit e.g. www.google.dehttp://www.google.de . The request gets
forwarded to the first of my server (as the second is only backup), but
the requested URL get exchanged to " / " . So my question is:
Is there a way to pass the requested URL, nginx is receiving, forward to
my two squid servers ?

I’m new to nginx, but i already googled and used the wiki, but I didnt
find anything useful

Thanks in advance!

Best Regards

Alex

On Wed, Oct 29, 2014 at 12:23:48PM +0000, [email protected]
wrote:

Hi there,

I’m trying to get nginx to work as a load balancer for 2 squid forward proxies.
I’m running nginx 1.6.2 on a Centos 7 64bit machine. Here’s my config:

I’m using my nginx in the proxy settings of my internet explorer and try to
visit e.g. www.google.dehttp://www.google.de .

nginx is not a http proxy server; and nginx does not speak to http
proxy servers.

You might be able to find a set of configs which mostly does what you
want; but you will probably be much happier if you use a tool which is
designed to do what you want, so that you won’t be fighting it.

Good luck with it,

f

Francis D. [email protected]

Hello!

On Wed, Oct 29, 2014 at 12:23:48PM +0000, [email protected]
wrote:

[…]

I’m using my nginx in the proxy settings of my internet explorer
and try to visit e.g. www.google.dehttp://www.google.de .
The request gets forwarded to the first of my server (as the
second is only backup), but the requested URL get exchanged to
" / " . So my question is:
Is there a way to pass the requested URL, nginx is receiving,
forward to my two squid servers ?

There is a problem with your setup. You are trying to use nginx
as a forward proxy, while nginx isn’t a forward proxy, it’s a
reverse proxy. While it is possible to configure nginx as a
forward proxy with some limitations (try google if you really wish
to do it), this isn’t something supported.


Maxim D.
http://nginx.org/

HI !

Thanks fort he reply. Yeah i know nginx is a reverse proxy, but i found
some tutorials using it in front of squid as forward proxy…well they
didnt really work… Seems like i have to look for another solution to
build a failover forward proxy :S

Regards
Alex

-----Ursprngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] Im Auftrag
von Maxim D.
Gesendet: Mittwoch, 29. Oktober 2014 14:51
An: [email protected]
Betreff: Re: Nginx Load Balancing Two Squid Forward Proxyies

Hello!

On Wed, Oct 29, 2014 at 12:23:48PM +0000, [email protected]
wrote:

[…]

I’m using my nginx in the proxy settings of my internet explorer and
try to visit e.g. www.google.dehttp://www.google.de .
The request gets forwarded to the first of my server (as the second is
only backup), but the requested URL get exchanged to " / " . So my
question is:
Is there a way to pass the requested URL, nginx is receiving, forward
to my two squid servers ?

There is a problem with your setup. You are trying to use nginx as a
forward proxy, while nginx isn’t a forward proxy, it’s a reverse proxy.
While it is possible to configure nginx as a forward proxy with some
limitations (try google if you really wish to do it), this isn’t
something supported.


Maxim D.
http://nginx.org/


nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx