[Qgis-user] QGIS Server setup <-- PostgreSQL/PostGIS

Sebastián Meyer sebastian at indomitux.com
Tue Feb 11 09:26:43 PST 2025


Hi,

I'm closer now thank you.

What I can't find in the docs is how to specify a database schema where 
I stored the projects table.

The URI is (db.schema.table) proyectos_qgis.qgis_metadata.qgis_projects


# Apache webserver config:
SetEnv PG_SERVICE_FILE "/var/www/.pg_service.conf"
SetEnv QGIS_PROJECT_FILE 
"postgresql://?service=myservice&schema=qgis_metadata&project=qgis_projects"

# pg_service.conf:
[myservice]
host=qgis.server
port=7000
dbname=proyectos_qgis
user=myuser
password=mypass
sslmode=disable

# Apache error log:
CRITICAL Server[1131060]: Error when loading project file 
'postgresql://?service=myservice&schema=qgis_metadata&project=qgis_projects': 
Unable to open 
postgresql://?service=myservice&schema=qgis_metadata&project=qgis_projects

The project 'qgis_projects' does not exist in schema 'qgis_metadata'.

But the qgis_projects does exist and I've tested access to the table.

TIA,

--
seb


El 9/2/25 a las 13:42, Gerald Kogler via QGIS-User escribió:
> Hi,
>
> The parameters you indicate don't exist, but there does exist 
> QGIS_PROJECT_FILE, see documentation at 
> https://docs.qgis.org/3.34/en/docs/server_manual/config.html#server-env-variables
>
> The best way to find possible connection problems or configuration 
> errors is to have a look at the QGIS Server logs.
>
> Good luck
> Gerald
>
>
> On 8/2/25 22:56, Sebastián Meyer via QGIS-User wrote:
>> Hi,
>>
>> I'm working on setting up a QGIS server which should retrieve 
>> projects and their layers from a PostgreSQL PostGIS enabled database, 
>> but I can't find (or I'm not understanding) how to do it.
>>
>> I've tried passing QGIS_PG_CONNECTION and QGIS_PROJECT_STORAGE 
>> variables through Apache without success (error codes 500 381)
>>
>> #My browser
>>
>> This XML file does not appear to have any style information 
>> associated with it. The document tree is shown below.
>> <ServerException>Project file error. For OWS services: please provide 
>> a SERVICE and a MAP parameter pointing to a valid QGIS project file</ 
>> ServerException>
>>
>>
>> What am I missing?
>>
>> For storing projects I'm using 'qgis_metadata' schema with a 
>> 'qgis_projects' table. For projects' layers, I'm grouping them in 
>> different schemas.
>>
>>
>> #Apache webserver config
>>
>> SetEnv QGIS_PG_CONNECTION "postgresql://user:pass@qgis.server:7000/ 
>> proyectos_qgis"
>> SetEnv QGIS_PROJECT_STORAGE "postgresql://user:pass@qgis.server:7000/ 
>> proyectos_qgis?qgis_metadata.qgis_projects"
>>
>>
>> I've tested database access.
>>
>>
>> -- 
>>
>> seb
>>
>> _______________________________________________
>> QGIS-User mailing list
>> QGIS-User at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
> _______________________________________________
> QGIS-User mailing list
> QGIS-User at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


More information about the QGIS-User mailing list