[Qgis-user] Configuring QGIS server on Ubuntu 20.4
Richard Greenwood
richard.greenwood at gmail.com
Sat Oct 2 19:01:40 PDT 2021
On Sat, Oct 2, 2021 at 10:02 AM Mats Elfström <mats.elfstrom at giskraft.se>
wrote:
> Hi!
> Let me just recuperate that the goal for QGIS server is to be used as a
> map and data server for webmaps on MapStore and to be harvestable by
> Geonetwork for a metadata catalogue. MapStore and Geonetwork are running on
> another machine. QGIS server shall run on a Ubuntu machine, along with data
> in PostGIS. The address for this machine is http://geonet.se
> Essentially, I see QGIS Server as an equivalent to Geoserver but with
> outstanding design capabilities.
>
> Here comes a run-through of an attempt to install QGIS server on an Ubuntu
> 20.4 system, using these instructions:
>
> https://docs.qgis.org/testing/en/docs/server_manual/getting_started.html#installation-on-debian-based-systems
> The first step is to install QGIS, according to this page
> https://qgis.org/en/site/forusers/alldownloads.html
> I opted to install qgis-server by adding that in the last command as
> suggested.
> No problems so far. Only, when returning to the first manual page, I see
> that I probably should have installed the LTR version instead of 3.20. If
> this is important, the user should be advised earlier, and instructed how
> to get the LTR version. For this review I will continue with 3.20.
> Next, the user is again advised to install qgis-server and optionally
> python-qgis. The motive for this is rather unclear at this stage, but I
> chose to install python as advised.
> Testing the installation by calling the fcgi seems to give a correct
> response, even if it differs from the two samples. Notice error code 302
> for instance.
> root at geonet:~# /usr/lib/cgi-bin/qgis_mapserv.fcgi
> Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment
> variable.
> Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment
> variable.
> Warning 1: Unable to find driver JP2ECW to unload from GDAL_SKIP
> environment variable.
> "Loading native module /usr/lib/qgis/server/libdummy.so"
> "Loading native module /usr/lib/qgis/server/liblandingpage.so"
> "Loading native module /usr/lib/qgis/server/libwcs.so"
> "Loading native module /usr/lib/qgis/server/libwfs.so"
> "Loading native module /usr/lib/qgis/server/libwfs3.so"
> "Loading native module /usr/lib/qgis/server/libwms.so"
> "Loading native module /usr/lib/qgis/server/libwmts.so"
> Content-Length: 0
> Location: http:/index.json
> Server: QGIS FCGI server - QGIS version 3.20.3-Odense
> Status: 302
>
> Next, it is suggested that I download a QGIS project or ‘use your own’ so
> I manually created the /home/qgis/projects/ folder, and then saved a simple
> QGIS project file to the folder. By default, this was saved in the qgz
> format.
> Then an HTTP server is needed.
> A note says *In the following, please replace localhost with the name or
> IP address of your server.*
> But localhost only appears in the string webmaster at localhost where it
> probably does not matter. There is no other mention of localhost in the
> configuration file.
> I go on to install Apache, as I have never used NGINX.
> *You can run QGIS Server on your default website*
> This is probably what I would want to do, but I do not know how, so I go
> on to create a virtualhost as instructed by the name qgis.demo. I make the
> log and qgisserverdb folders as instructed and set their permissions. Then
> I enable fcgid and the site qgis.demo. The last command advises to run
> systemctl reload apache2, but the manual suggests systemctl restart
> apache2. I do both just to make sure. Then comes a tricky part, adding the
> virtualhost to the hosts file. After that operation, it contains this. Note
> that the server IP address got two definitions. I am bothered by this.
> 127.0.0.1 localhost
> ::1 localhost ip6-localhost ip6-loopback
> ff02::1 ip6-allnodes
> ff02::2 ip6-allrouters
>
> # Auto-generated hostname. Please do not remove this comment.
> 206.72.203.32 geonet.se geonet
> 206.72.203.32 qgis.demo
>
> Calling
> http://qgis.demo/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
> from within the server gives
>
>
> *<ServerException>Project file error. For OWS services: please provide a
> SERVICE and a MAP parameter pointing to a valid QGIS project
> file</ServerException>*
>
> This seems correct. However, there is a totally confusing note here.
> *Remember that both the myhost.conf and /etc/hosts files should be
> configured for your setup to work. You can also test the access to your
> QGIS Server from other clients on the network (e.g. Windows or macOS
> machines) by going to their /etc/hosts file and point the myhost name to
> whatever IP the server machine has on the network (not 127.0.0.1 as it is
> the local IP, only accessible from the local machine). On *nix machines the
> hosts file is located in /etc, while on Windows it’s under the
> C:\Windows\System32\drivers\etc directory. Under Windows you need to start
> your text editor with administrator privileges before opening the hosts
> file.*
> What is myhost.conf and what should it contain? The rest is very strange.
> My goal is to access QGIS server from the internet, using the
> http://geonet.se address, looked up by DNS as usual. Not from ‘other
> clients on the network’ and the *myhost *name. What would be the point
> for this? Not surprising,
>
> http://geonet.se/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
> from the outside returns
>
>
> *Not FoundThe requested URL was not found on this server.Apache/2.4.41
> (Ubuntu) Server at geonet.se <http://geonet.se> Port 80 *
> Doing just http://geonet.se returns the Apache2 Ubuntu Default Page
> And here the show stops.
>
> - I might add that PostgreSQL and Geoserver are accessible from the
> outside, and Geoserver serves WMS to the Internet as expected. Port 80 is
> obviously open too.
> - I can also access QGIS server from QGIS desktop *on the same machine*,
> using http://qgis.demo as root. But I had to include a MAP request in
> the string, with a full path to the project file.
>
>
> Conclusion: The missing piece of information seems to be how to make
> Apache2 direct incoming requests to QGIS Server, OR how to configure QGIS
> server to run as *your default website. *As all the rest depends on this,
> it is a vital piece of information.
>
Matts,
I am not a qgis server user so I am not the best qualified to answer your
questions, but it sounds like you probably have qgis server installed
properly and your problems are with Apache. Does your Linux machine have a
desktop (a GUI)? If so, in a browser enter:
http://localhost/cgi-bin/qgis_mapserv.fcgi?service=WMS&request=getcapabilities
and you will see an xml document if the request is successful. If you Linux
machine is headless, in a shell enter:
curl "
http://localhost/cgi-bin/qgis_mapserv.fcgi?service=WMS&request=getcapabilities
"
and you will see an xml document if the request is successful.
A default Ubuntu install with Apache makes /cgi-bin/* available to all
hosts on that server if cgi and fcigd have been enabled.
--
Richard W. Greenwood, PLS
www.greenwoodmap.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20211002/f0b235d3/attachment.html>
More information about the Qgis-user
mailing list