April 26, 2011 07:37PM
I'm sure there are a few different ways to accomplish this, personally I'm working on a dynamic method to perform this with a mysql backend. For a more simplistic method, maybe try using a map hash for the backend_server variable that is matched against the incoming $http_host:

map_hash_bucket_size 64;

map $http_host $backend_server {
hostnames;

default backend-apache1.example.com;
my-frontend-alias.example.com vip-super-secret-backend.example.com
my-other-alias.example5.com vip-other-secret-backend.example2.com
}


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;

server 80 {

location / {

proxy_pass http://$backend_server

}

}


Just an example, I'm sure I'm missing something above... :)
Subject Author Posted

nginx as reverse proxy for many domains (many ips in proxypass?)

Anonymous User April 26, 2011 06:04PM

Re: nginx as reverse proxy for many domains (many ips in proxypass?)

gregr401 April 26, 2011 07:37PM

Re: nginx as reverse proxy for many domains (many ips in proxypass?)

gregr401 April 26, 2011 08:18PM

Re: nginx as reverse proxy for many domains (many ips in proxypass?)

SplitIce April 27, 2011 02:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 177
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