Postgresql 无法从pgAdmin访问数据库

Postgresql 无法从pgAdmin访问数据库,postgresql,nginx,Postgresql,Nginx,我在我的web服务器(ubuntu+nginx)上使用postgresql数据库,它与后端应用程序配合使用。我想使用pgAdmin远程连接 但它总是抛出这样的错误: could not connect to server: Connection timed out(0x0000274C/10060) Is the server running on host "ip" and accepting TCP/IP connections on port 5432? 我已经在pg_hba.conf

我在我的web服务器(ubuntu+nginx)上使用postgresql数据库,它与后端应用程序配合使用。我想使用pgAdmin远程连接 但它总是抛出这样的错误:

could not connect to server: Connection timed out(0x0000274C/10060)
Is the server running on host "ip" and accepting
TCP/IP connections on port 5432?

我已经在pg_hba.conf中添加了以下内容:

主机所有密码

并添加到postgresql.conf行:

侦听地址='*'

netstat-nlt做下一个结果,我找到的图库已经足够了,但仍然无法访问我的数据库


打开名为pg_hba.conf的文件

sudo vi pg_hba.conf
并将这一行添加到该文件中

host  all  all 0.0.0.0/0 md5
它允许所有用户使用加密密码访问所有数据库

重新启动服务器

sudo /etc/init.d/postgresql restart

找到一个解决方案,在执行以下命令后也可以使用:

sudo ufw允许5432/tcp

我按照上面所示做了,但结果还是一样的