Answer the question
In order to leave comments, you need to log in
How to connect to Postgres that does not have public access?
Good afternoon!
There are two servers on Ubuntu 18.04, the first one has a public IP and nginx, and the second one is a postgres database server and there is no remote access to it. You need to configure it so that you can connect to the database through the first server. It is advisable to do this through nginx, since the firewall settings and all sorts of iptables cannot be touched there.
I understand that this is a type of port forwarding or something like that, but so far I can’t make it work.
Answer the question
In order to leave comments, you need to log in
Solved using this rule in nginx
stream {
upstream backend {
server 192.168.1.50:6432;
}
server {
listen 8099;
proxy_pass backend;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question