$ sudo -u postgres createuser -P cronly
$ sudo -u postgres psql
psql (10.5 (Ubuntu 10.5-2.pgdg16.04+1))
Type "help" for help.
postgres=# ALTER USER my_username WITH PASSWORD 'my_password';
ALTER ROLE
postgres=# ALTER USER my_username CREATEDB;
ALTER ROLE
postgres=# \q
host database username samenet md5
createdb -U my_username -h hostname database
HTTP Reverse Proxy (credit)
conf.d/default.conf
upstream http_backend {
server HOST_OR_IP:PORT;
}
server {
listen 80;
server_name HOSTNAME;
location /[PATH] {
proxy_pass http://http_backend/;
}
...
}
TCP Reverse Proxy (credit)
nginx.conf
...
stream {
upstream tcp_backend {
server HOST_OR_IP:PORT;
}
server {
listen TCP_PORT;
proxy_pass tcp_backend;
}
}
...
Load Balance (credit)
*.conf
upstream backend {
# round robin is default
# least_conn;
# hash $remote_addr;
# random;
server SERVER1:PORT [weight=5];
server SERVER2:PORT [max_conns=3];
server SERVER3:PORT [max_fails=2 fail_timeout=30s]; # passive health check
...
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/example.com/html;
index index.html index.htm;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ =404;
}
}
server {
listen 80;
listen [::]:80;
root /var/www/test.com/html;
index index.html index.htm;
server_name test.com www.test.com;
location / {
try_files $uri $uri/ =404;
}
}