I am trying to publish a WMS via QGIS using QGIS Server. It works when the data for the QGIS project are shapefiles that I put in the same folder as the project on the QGIS Server (/usr/lib/cgi-bin/qgis-server/projectfolder).

Now I have data that are stored in a PostGIS database. When trying to load the WMS in OpenLayers it doesn´t load the requested WMS layer. I assume that the problem is that it fails to connect to the database since the password is not stored anywhere. I stored the connection to the database in QGIS Desktop but it looks like this information is not passed to the Server.

I am using:

QGIS-Version: 2.14.8-Essen
Apache-Version: 2.4.7
PostgreSQL-Version: 9.3.16
PostGIS: 2.1.2 r12389
  • i know its an old thread. but still were you able to solve the issue, if yes would you like to share the steps?
    – Aneer Geek
    Mar 28, 2020 at 4:25

1 Answer 1


May be this will help

you need to edit pg_hba.conf file and change the connection methos as md5:

# Database administrative login by Unix domain socket

local all postgres md5

Restart postgresql server

Check for datasource tag in your .qgis project file which you have copied in your 'cgi-bin/poject/' location and then edit the proper user and password for your database.

Resart the apache and try it again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.