Reverse proxy for multiple websites

Hi,

I’m sticking on configure a reverse proxy, my scenario looks like:

Internet
…|
…|__Reverse proxy (listen port 80)
…|__web1.com (listen port 8080)
…|__web2.net (listen port 8080)
…|__web-n.org (listen port 8080)

Assume All website shared one public IP only and each website runs on
independent VPS.

If I create multi server{} block to use proxy_pass directive to web
server inside, it’s only web1.com can be reachable (perhaps it’s on
top config).

It’s highly appreciate if someone advice me ideas to make this working.

Thanks,


Best regards,
Hai N., Nguyen

Hello!

On Mon, Jan 02, 2012 at 12:10:59PM +0700, Nguyen Hai N. wrote:

Assume All website shared one public IP only and each website runs on
independent VPS.

If I create multi server{} block to use proxy_pass directive to web
server inside, it’s only web1.com can be reachable (perhaps it’s on
top config).

It’s highly appreciate if someone advice me ideas to make this working.

If many backend sites share the same ip, and you refer all of them
with the same name (or ip) in proxy_pass directive, you probably
want to use somethine like

proxy_set_header Host <name>;

to make sure backend will be able to distinguish them. Or just

proxy_set_header Host $host;

to pass what you’ve got from client.

Maxim D.

hi,
Can u show ur configuration?

Dev

Posted at Nginx Forum:

dev Wrote:

hi,
Can u show ur configuration?

Dev

Hi Dev,

I’ve followed this document
http://nginx.org/en/docs/http/request_processing.html

And I think my problem was missing deffinitions for “www.domain.tld” in
server_name; after edit it to

server_name domain.tld www.domain.tld;

the problem solved.

Thanks for your attention.
~Neddy

Posted at Nginx Forum: