Hi Amedeo,

Is the www-data user able to read the pg service file? If you didn't change the permissions, /home/ubuntu/.pg_service.conf is only readable by ubuntu user.

Can you check the qgis server logs to see what is going on?

Best regards,

Jorge

Às 21:05 de 07/07/25, Amedeo Fadini via QGIS-User escreveu:
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 <ame...@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


_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info:https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user
--
*Geomaster, LDA *
*VENHA DESCOBRIR O CAMINHO DO OPEN SOURCE CONNOSC *

Rua Afonso Palmeira, 31, 7 D
4715-278 Braga
VAT/NIF 510 906 109
Phone  +351 253 257 173
Site geomaster.pt <http://geomaster.pt>
GPS 41.54627, -8.40432
Logo    
------------------------------------------------------------------------
        
Jorge Gustavo Rocha
CTO

Mobile   +351 910 333 888
Email j...@geomaster.pt
_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to