[Qgis-user] Qgis server postgis layers not valid (but desktop works on same machine)

Amedeo Fadini amefad at gmail.com
Mon Jul 7 13:05:35 PDT 2025


Errata corrige, the demo project works, the sqlite file was with wrong
permission.
Still doesn't load postgis layer

Amedeo

Il giorno lun 7 lug 2025 alle ore 21:54 Amedeo Fadini <amefad at gmail.com> ha
scritto:

> Hi everybody,
>
> I'm upgrading a project based on QGIS server and moved all stuff to new
> server with Ubuntu 24, QGIS 3.40 LTR postgresql 16.
> Webserver is nginx, QGIS server is configured on spawn-fcgi with single
> socket follwing the qgis manual
>
> https://docs.qgis.org/3.40/en/docs/server_manual/getting_started.html#spawn-fcgi
> The project use two layers from postgis, the connection is configured with
> pg service
>
> Connecting on ssh with x.forwarding the project loads without any error
> and works fine
>
> Calling the qgis server getcapabilities or get projectsettings it raise
> the error
> <ServerException>Layer(s) not valid</ServerException>
> Setting QGIS_SERVER_IGNORE_BAD_LAYERS=true getcapabilities works but
> postgis layer are not published or not showed in Getmap request.
>
> Any clue? Where can  I find more detailed erro log?
>
> even the demo project world.qgs gives balnk image in getmap request. Am I
> misisng a local Xserver or gui configuration?
>
> Below is my nginx conf and systemd/system/qgis-server.service
>
> Thank you
>
> Amedeo Fadini
>
> ---
> server {
>     listen 80;
>     server_name <my server name>;
>
>     location /qgis/ {
>         include fastcgi_params;
>         fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/qgis_mapserv.fcgi;
>         #fastcgi_param  QGIS_DEBUG              1;
>         fastcgi_param QGIS_SERVER_LOG_STDERR 1;
>         #fastcgi_param QGIS_SERVER_LOG_LEVEL 0;
>         fastcgi_param QGIS_SERVER_LOG_LEVEL 2;
>         #fastcgi_param  PGSERVICEFILE /home/ubuntu/.pg_service.conf;
>         #fastcgi_param  QGIS_PROJECT_FILE
> /home/ubuntu/fiduciali_qgis/fiduciali.qgs;
>         fastcgi_pass  unix:/var/run/qgisserver.socket;
>     }
> }
>
>
> ---
>
> [Unit]
> Description=QGIS server
> After=network.target
>
> [Service]
> ;; set env var as needed
> ;Environment="LANG=en_EN.UTF-8"
> ;Environment="QGIS_SERVER_PARALLEL_RENDERING=1"
> ;Environment="QGIS_SERVER_MAX_THREADS=12"
> Environment="QGIS_SERVER_LOG_LEVEL=0"
> Environment="QGIS_SERVER_LOG_STDERR=1"
> Environment="PGSERVICEFILE=/home/ubuntu/.pg_service.conf"
> ;Environment="QGIS_PROJECT_FILE=/var/www/qgis_projects/world.qgs"
> Environment="QGIS_PROJECT_FILE=/var/www/qgis_projects/fiduciali.qgs"
> Environment="QGIS_SERVER_IGNORE_BAD_LAYERS=true"
> ;; or use a file:
> ;EnvironmentFile=/etc/qgis-server-env
>
> ExecStart=spawn-fcgi -s /var/run/qgisserver.socket -U www-data -G www-data
> -n /usr/lib/cgi-bin>
>
> [Install]
> WantedBy=multi-user.target
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20250707/4fa9c4ce/attachment.htm>


More information about the QGIS-User mailing list