リッスンするIPアドレスの指定
postgresql.confの修正
cd /etc/postgresql/9.6/main
cp postgresql.conf postgresql.conf.$(date +%Y%m%d)
vi -u NONE postgresql.conf
------------------------------------------------
listen_addresses = 'localhost'
listen_addresses = '*'
listen_addresses = '192.168.0.1'
listen_addresses = '192.168.0.1,192.168.0.2'
------------------------------------------------
- *で全インターフェース、,(カンマ)区切りで複数指定できる
設定適用(再起動)
systemctl restart postgresql
補足
- セキュリティ的なアクセス制御はpg_hba.confで行う
参考
https://stackoverflow.com/questions/9764126/how-to-configure-postgresql-postgresql-conf-listen-addresses-for-multiple-ip-add