geomiles
geomiles

Reputation: 305

Remote Access to PostGIS

For the last three/four months i've deployed PostGIS locally but now i've just been given a server to deploy PostGIS on and scale up my open source adventures. I've installed Postgres/gis and its working just fine on my Windows server, but how do I connect to it from my desktop pc (via QGIS). I've looked around for threads on 'Remote Access PostGIS on Windows Server' and variation of, but haven’t actually found anything concrete.

I get the gist that I have to edit the some of the Postgres config files to allow remote access, but the threads that do comment on doing this all offer difference solutions. Very confused!

Upvotes: 4

Views: 2794

Answers (2)

acanimal
acanimal

Reputation: 5020

Take spacial attention to the

listen_addresses='*'

configuration in postgresql.conf.

By default it only allows local conections and you need to put the '*' to allows connection from any machine.

Upvotes: 1

Mike T
Mike T

Reputation: 43642

In short, yes. It's built into the IP protocol used by PostgreSQL.

However, it partially depends on your network. Does your Windows Server have either a static IP or a DNS name (e.g., yourname.com)? If your server have a dynamic IP, try something like http://dyn.com/dns/. Furthermore, if your server is behind a firewall or router, you might need to use port forwarding to expose the PostgreSQL port (usually 5432) to outside traffic.

The PostgreSQL/PostGIS side of things is easier to set up. There are tonnes of resources out in the web to tell you how to enable remote connections to a PostgreSQL database (e.g. this). Basically, you need to edit your postgresql.conf and pg_hba.conf files, and either restart and/or refresh your server.

To connect from QGIS, make a new connection with the DNS name or IP address in "Host". I frequently use QGIS to connect to remote servers.

Upvotes: 2

Related Questions