Postgres#
The Postgres module provides direct support for PostgreSQL databases. To install the module, use one of the following packages: Angie: Angie PRO: Connecting the module in the context of Detailed documentation and source code are available at:
FRiCKLE/ngx_postgresInstallation#
angie-module-postgres
angie-pro-module-postgres
Loading the Module#
main{}
:load_module modules/ngx_postgres_module.so;
Configuration Example#
http {
upstream database {
postgres_server 127.0.0.1 dbname=ang_test
user=ang_test password=ang_test;
}
server {
listen 80;
postgres_output text;
location /create {
postgres_pass database;
postgres_query "CREATE TABLE cats (id integer, name text)";
}
location /insert {
postgres_pass database;
postgres_query "INSERT INTO cats (id, name) VALUES ($arg_id, '$arg_name')";
}
location /select {
postgres_pass database;
postgres_query "SELECT name FROM cats WHERE id=$arg_id";
}
}
}
Additional Information#