FRiCKLE/ngx_postgres — Issue #11: Support for multiple database connections
Author: shantanoo
Created: 2012-01-13 07:18:34+00:00
State: open

Currently only one upstream database is supported. In the 'http' section of the nginx.conf file. For different 'server' section in nginx.conf file, how to get different upstream database?

e.g.
===

http {

upstream database {
postgres_server 127.0.0.1 dbname= user= password=;
}

....

===

http {

server {
location = /numbers/ {
postgres_pass database;
rds_json on;

postgres_query HEAD GET "SELECT * FROM

";
}
server_name vhost1;
upstream database {
postgres_server 127.0.0.1 dbname= user= password=;
}
}
server {
location = /alphabets/ {
postgres_pass database;
rds_json on;

postgres_query HEAD GET "SELECT * FROM ";
}
server_name vhost2;
upstream database {
postgres_server 127.0.0.1 dbname= user= password=;
}
}

...
===