PostgreSQL#
The Postgres module provides direct support for PostgreSQL databases.
Installation#
To install the module, use one of the following packages:
Angie:
angie-module-postgresAngie PRO:
angie-pro-module-postgres
Loading the Module#
Load the module in the main{} context:
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#
Version: 1.0rc7
Detailed documentation and source code are available at: FRiCKLE/ngx_postgres