Closed shantanoo closed 12 years ago
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?
http {
upstream database { postgres_server 127.0.0.1 dbname=<dbname> user=<user> password=<password>; }
....
server { location = /numbers/ { postgres_pass database; rds_json on; postgres_query HEAD GET "SELECT * FROM <table>"; } server_name vhost1; upstream database { postgres_server 127.0.0.1 dbname=<dbname> user=<user> password=<password>; } } server { location = /alphabets/ { postgres_pass database; rds_json on; postgres_query HEAD GET "SELECT * FROM <another_table>"; } server_name vhost2; upstream database { postgres_server 127.0.0.1 dbname=<another_dbname> user=<another_user> password=<another_password>; } }
Just use different upstream names:
upstream database1 { ... } upstream database2 { ... }
Thanks. I assumed 'database' as keyword instead of the connection name.
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 {
....
http {
...