Py-qgis-server on cloud server

I use a cloud server with Ubuntu 24.04 on Hetzner. Communicate with it via putty app. Starting „service qgis start“ give me an error with the DISPLAY environment. Any idea how to fix this problem?

Part of log file:
qgisserver 1.9.6 (build 202506101134, commit 1565a8e)
QGIS 3.40.10-Bratislava ‘Bratislava’ (c98da2e6828)
QGIS code revision c98da2e6828
Qt version 5.15.13
Python version 3.12.3
GDAL/OGR version 3.8.4
PROJ version 9.4.0
EPSG Registry database version v11.004 (2024-02-24)
GEOS version 3.12.1-CAPI-1.18.1
SQLite version 3.45.1
OS Ubuntu 24.04.3 LTS

2025-08-28 18:54:18,500 INFO [7643] Binding frontend to ipc:///tmp/qgssrv/broker/7642/0
2025-08-28 18:54:18,501 INFO [7643] Binding backend to ipc:///tmp/qgssrv/broker/7642/pool0
2025-08-28 18:54:18,502 INFO [7643] Starting ZMQ broker loop
2025-08-28 18:54:18,503 INFO [7646] Starting worker pool
2025-08-28 18:54:18,503 INFO [7642] Running server on port 127.0.0.1:7200
2025-08-28 18:54:18,504 INFO [7642] Starting client b’OWS-SERVER-7642’
2025-08-28 18:54:18,506 INFO [7642] Initializing supervisor
2025-08-28 18:54:18,506 INFO [7642] Initializing pool healthcheck
2025-08-28 18:54:18,507 INFO [7642] Starting processing requests
2025-08-28 18:54:18,509 INFO [7651] >>>>> Qgis Projects options:
** Getprint Disabled…No
** Trust Layer Metadata…Yes
** Readonly Layers…Yes
<<<<<
2025-08-28 18:54:18,515 INFO [7652] >>>>> Qgis Projects options:
** Getprint Disabled…No
** Trust Layer Metadata…Yes
** Readonly Layers…Yes
<<<<<
2025-08-28 18:54:18,517 INFO [7653] >>>>> Qgis Projects options:
** Getprint Disabled…No
** Trust Layer Metadata…Yes
** Readonly Layers…Yes
<<<<<
2025-08-28 18:54:18,522 INFO [7654] >>>>> Qgis Projects options:
** Getprint Disabled…No
** Trust Layer Metadata…Yes
** Readonly Layers…Yes
<<<<<
2025-08-28 18:54:18,531 INFO [7653] Starting Qgis application: 3.40.10-Bratislava
2025-08-28 18:54:18,531 INFO [7653] Using DISPLAY: :99
2025-08-28 18:54:18,532 INFO [7651] Starting Qgis application: 3.40.10-Bratislava
2025-08-28 18:54:18,532 INFO [7651] Using DISPLAY: :99
qt.qpa.xcb: could not connect to display :99
qt.qpa.plugin: Could not load the Qt platform plugin “xcb” in “” even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite
-glx, xcb.

2025-08-28 18:54:18,536 INFO [7654] Starting Qgis application: 3.40.10-Bratislava
2025-08-28 18:54:18,536 INFO [7654] Using DISPLAY: :99

Have you installed xvfb (see my script)?

Yes and this was the problem!

I allow me to publish your hint:

sudo apt-get install xvfb

Create the service file with text below:

/etc/systemd/system/xvfb.service

[Unit]
Description=X Virtual Frame Buffer Service
After=network.target

[Service]
ExecStart=/usr/bin/Xvfb :99 -screen 0 1024x768x24 -ac +extension GLX +render -no
reset

[Install]
WantedBy=multi-user.target

Finally

sudo systemctl enable xvfb.service
sudo systemctl start xvfb.service
sudo systemctl status xvfb.service
1 Like

All is working now as expected with the exception that the preload function of py-qgis-server is not working.

I’m writing something about preloading on Lizmap-de.

This solved the problem with py-qgis-server but after that my remote desktop communication not anymore working through the putty tunnel.

Has somebody a solution with that?

I found a solution from mikfilltrade/virtual-display-setup. After performing this I was again able to use Remote Desktop to the server in the cloud.

Hey Peter,
glad you got it working again.
Just my two cents: security wise, I would heavily advice against a (continously) running VNC server on a web server. If you really need VNC to that server (why do you need a desktop environment on a server?), start it via ssh when needed and stop the service when ending your VNC session!