listen_addresses
Network interfaces the server accepts TCP connections on.
- Standard
localhost- Range
- Host names, IP addresses, '*' or ''
- Restart needed
- Ja
- Default checked on
- PostgreSQL 18
Was es bewirkt
A comma-separated list of host names or IP addresses; '*' means all interfaces and an empty string means Unix sockets only. Which clients may log in is still decided by pg_hba.conf.
Standardwert
localhost. localhost (PostgreSQL 18). The official Docker image sets '*' so the port can be published; this reference's test container reports '*'.
Check the current value
SHOW listen_addresses; SELECT setting, unit, boot_val, context, source, pending_restart FROM pg_settings WHERE name = 'listen_addresses';
Change it
ALTER SYSTEM SET listen_addresses = '10.0.0.5,localhost'; -- applies only after a server restart
Server restart required (pg_settings.context is postmaster). ALTER SYSTEM only stages the new value in postgresql.auto.conf.
When to change it
Bind to the private interface the application uses when the server must accept remote connections.
What can go wrong
'*' on a host with a public interface exposes the port to the internet; keep pg_hba.conf restrictive and require scram-sha-256.
Questions about listen_addresses
What is the default value of listen_addresses in PostgreSQL?
localhost. localhost (PostgreSQL 18). The official Docker image sets '*' so the port can be published; this reference's test container reports '*'.
Does changing listen_addresses require a restart?
Yes. Server restart required (pg_settings.context is postmaster). ALTER SYSTEM only stages the new value in postgresql.auto.conf.
When should I change listen_addresses?
Bind to the private interface the application uses when the server must accept remote connections.
Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.
Check listen_addresses on your own server
SQLly runs the query above against PostgreSQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.