Welcome! Log In Create A New Profile

Advanced

Reverse proxy and eth1

Posted by mschipperheyn 
Reverse proxy and eth1
February 06, 2011 07:27AM
Hi,

I'm trying to create a reverse proxy on Rackspace with nginx and tomcat.

Rackspace servers have two ethernet adapters eth0 (public internet, public ip address) and eth1 (private Rackspace network, private ip address, no bandwidth costs).

I can't get my nginx webserver to connect to the appserver over the local ip address. I keep getting a timeout. I'm thinking, not sure, that nginx is trying to route the reverse proxy request over the eth0 when it should be routing it over eth1.

Can you give me any suggestions on how to configure for this?

Kind regards,

Marc
Re: Reverse proxy and eth1
February 07, 2011 01:52PM
I'm trying to use proxy_bind but it doesn't work.

I have
[b]Web server nginx[/b]
eth0
private ip: 2.2.2.200

eth1
public/internet ip: 1.1.1.200

[b]App server tomcat[/b]
eth0
private ip: 2.2.2.100

eth1
public ip: 1.1.1.100


My nginx config is like so
[code]

nginx.conf
http {
upstream msa {
server 2.2.2.100:8080;
}
[...]

site config
[...]
location @proxy {
auth_basic "Restricted";
auth_basic_user_file /usr/local/etc/passwords;


proxy_buffering on;
proxy_bind 2.2.2.100;
proxy_cache STATIC;
proxy_pass http://msa;
proxy_cache_valid 200 15m;
proxy_cache_valid 404 5m;
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;
proxy_cache_key $host$request_uri;
proxy_ignore_headers Set-Cookie;
proxy_cache_bypass $proxy_bypass;


proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
#proxy_max_temp_file_size 0;
#proxy_store off;

proxy_connect_timeout 30;
proxy_send_timeout 30;
proxy_read_timeout 30;

}

[/code]

I'm seeing these kinds of errors
2011/02/07 18:30:20 [error] 4907#0: *1 connect() failed (110: Connection timed out) while connecting to upstream, client: 201.83.48.178, server: _, request: "GET / HTTP/1.1", upstream: "http://2.2.2.100:8080/", host: "1.1.1.200"

I would expect a connect of upstream: http://2.2.2.100:8080, host 2.2.2.200

The whole set up does work when I run it across eth1, the default. It seems like the proxy_bind command is ignored. I have nginx 0.8.54 based on Brian's distro.

Please help.

Kind regards,

MArc
Re: Reverse proxy and eth1
February 07, 2011 02:31PM
Sorry, I made a typo in the config for the example.
proxy_bind 2.2.2.100
Re: Reverse proxy and eth1
February 12, 2011 08:04PM
Come on guys, some help or suggestions please

Kind regards,
Marc
Re: Reverse proxy and eth1
February 15, 2011 09:24AM
Ok, resolved, running tcpdump on eth1 showed me a stupid configuration error on my side
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 158
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready