0
我在使用Postgres.app的Mac上运行Postgres服务器。无法设置Postgres服务器接受SSL连接
我连接到的Node.js服务器(代码Heroku docs复制):
pg.defaults.ssl = true;
pg.connect(process.env.DATABASE_URL || 'postgres://localhost:5432/my-project', function(err, client) {
if (err) throw err;
console.log('Connected to postgres! Getting schemas...');
client
.query('SELECT table_schema,table_name FROM information_schema.tables;')
.on('row', function(row) {
console.log(JSON.stringify(row));
});
});
然后我跟着指示here,让我的Postgres的服务器接受SSL连接。我在postgresql.conf
文件中将ssl
设置更改为on
。我还生成了所需的文件,server.key
和server.crt
。
然而,当我跑我的节点服务器,我得到这个错误:
Error: The server does not support SSL connections
我跑psql
,做show ssl
。它返回off
。所以后来我想,也许我有错误的配置文件...但后来我做了show config_file
,我绝对是在正确的地方。我还有什么遗漏?
不,我肯定重新启动...在退出Postgres应用程序后,找不到任何进程或连接psql。 – chinaowl
没有在日志中?然后,无论您是否意外连接到错误的服务器,或者PostgreSQL已经在没有SSL支持的情况下编译,运行'pg_config --configure'来查找。 –
呃......我觉得很傻。发现我的问题。我忘了在配置文件的'ssl = on'行中删除'#'。 – chinaowl