<div dir="ltr"><div dir="ltr"><div>Hi!</div><div>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 <a href="http://geonet.se">http://geonet.se</a></div><div>Essentially, I see QGIS Server as an equivalent to Geoserver but with outstanding design capabilities.</div><div><br></div>Here comes a run-through of an attempt to install QGIS server on an Ubuntu 20.4 system, using these instructions: <div><a href="https://docs.qgis.org/testing/en/docs/server_manual/getting_started.html#installation-on-debian-based-systems">https://docs.qgis.org/testing/en/docs/server_manual/getting_started.html#installation-on-debian-based-systems</a><br>The first step is to install QGIS, according to this page</div><div><a href="https://qgis.org/en/site/forusers/alldownloads.html">https://qgis.org/en/site/forusers/alldownloads.html</a></div><div>I opted to install qgis-server by adding that in the last command as suggested.<br>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.<br>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.<br>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.<br><font face="monospace">root@geonet:~# /usr/lib/cgi-bin/qgis_mapserv.fcgi<br>Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable.<br>Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable.<br>Warning 1: Unable to find driver JP2ECW to unload from GDAL_SKIP environment variable.<br>"Loading native module /usr/lib/qgis/server/libdummy.so"<br>"Loading native module /usr/lib/qgis/server/liblandingpage.so"<br>"Loading native module /usr/lib/qgis/server/libwcs.so"<br>"Loading native module /usr/lib/qgis/server/libwfs.so"<br>"Loading native module /usr/lib/qgis/server/libwfs3.so"<br>"Loading native module /usr/lib/qgis/server/libwms.so"<br>"Loading native module /usr/lib/qgis/server/libwmts.so"<br>Content-Length: 0<br>Location: http:/index.json<br>Server:  QGIS FCGI server - QGIS version 3.20.3-Odense<br>Status:  302</font><br><br>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.<br>Then an HTTP server is needed.<br>A note says <b><i>In the following, please replace localhost with the name or IP address of your server</i>.</b><br>But localhost only appears in the string webmaster@localhost where it probably does not matter. There is no other mention of localhost in the configuration file.<br>I go on to install Apache, as I have never used NGINX.<br><b><i>You can run QGIS Server on your default website</i></b><br>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.<br><font face="monospace">127.0.0.1     localhost<br>::1              localhost ip6-localhost ip6-loopback<br>ff02::1         ip6-allnodes<br>ff02::2         ip6-allrouters<br><br># Auto-generated hostname. Please do not remove this comment.<br>206.72.203.32 <a href="http://geonet.se">geonet.se</a> geonet<br>206.72.203.32 qgis.demo</font><br><br>Calling <a href="http://qgis.demo/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities">http://qgis.demo/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities</a> from within the server gives <br><b><ServerException><br>Project file error. For OWS services: please provide a SERVICE and a MAP parameter pointing to a valid QGIS project file<br></ServerException></b><br><br>This seems correct. However, there is a totally confusing note here.<br><i><b>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.</b></i><br>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 <a href="http://geonet.se">http://geonet.se</a> address, looked up by DNS as usual. Not from ‘other clients on the network’ and the <i>myhost </i>name. What would be the point for this? Not surprising, <br><a href="http://geonet.se/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities">http://geonet.se/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities</a><br>from the outside returns<br><i style=""><b>Not Found<br>The requested URL was not found on this server.<br>Apache/2.4.41 (Ubuntu) Server at <a href="http://geonet.se">geonet.se</a> Port 80 </b></i><br>Doing just <a href="http://geonet.se">http://geonet.se</a> returns the Apache2 Ubuntu Default Page<br>And here the show stops.<br><ul><li>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.</li><li>I can also access QGIS server from QGIS desktop <u>on the same machine</u>, using <a href="http://qgis.demo">http://qgis.demo</a> as root. But I had to include a MAP request in the string, with a full path to the project file.</li></ul></div><div><br></div><div>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 <b><i>your default website. </i></b>As all the rest depends on this, it is a vital piece of information.</div><div><b><i><br></i></b></div><div><b><i>Regards, Mats.E</i></b></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Den tors 30 sep. 2021 kl 21:25 skrev Alessandro Pasotti <<a href="mailto:apasotti@gmail.com">apasotti@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div><br></div><div>Hi, I'm sorry to hear that: we have even recently spent a considerable amount of time (and money, because it was financed with a grant) to rewrite the QGIS Server documentation with detailed information about deployment [1], we have clearly missed the goal if you couldn't find what you needed in these pages.</div><div><br></div><div>It would be useful to know what exactly were your problems and what did you try to do.</div><div><br></div><div>A common problem with server deployments is that there are multiple ways of doing things, it really depends on what you need, for example we are now commonly using docker containers (there are many out there that provide a QGIS Server working installation almost without the need to manually configure anything).</div><div><br></div><div>Also, I tend to use nginx, but apache is totally fine too.</div><div><br></div><div>[1] <a href="https://docs.qgis.org/3.16/en/docs/server_manual/getting_started.html#installation-on-debian-based-systems" target="_blank">https://docs.qgis.org/3.16/en/docs/server_manual/getting_started.html#installation-on-debian-based-systems</a></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 30, 2021 at 8:24 PM Mats Elfström <<a href="mailto:mats.elfstrom@giskraft.se" target="_blank">mats.elfstrom@giskraft.se</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi!<div>I am setting up a Geodata stack. I have installed PostgreSQL/Postgis and Geoserver under Tomcat9 and FME:d a lot of data to PostGIS. All is up and running.</div><div>Then I installed QGIS 3.20. No problems so far. Then I decided to try QGIS server as an alternative to Geoserver. But I am having trouble configuring QGIS server, or Apache2 rather.</div><div>Over the past 5-6 years, I have spent more time and energy than I care to mention trying to make QGIS server run on Windows servers. Asking for advice on those occasions, I have more than once got the advice to use Linux instead, since no QGIS developers really know Windows servers. And Linux would be much easier.</div><div>Fair enough. So now I am on Ubuntu, sudoing this and that and it works pretty well.</div><div>Apart from QGIS server. I find the same mess of incomplete or contradictory instructions. No wonder QGIS server is under-used.</div><div>If Linux(Ubuntu) is so simple, how come no one has put together a working script to configure and deploy QGIS server on a standard setup?</div><div>I am most disappointed, having spent yet 5 hrs that I will never get back on QGIS server.</div><div><br></div><div>Regards, Mats.E</div><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><span><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><p><b><img><br></b></p><p><b>GisKraft</b>, Geodatakonsult</p><p>Mats Elfström,
Marsvinsholms stationsväg 80, 271 93 Ystad, Sweden<br>tel: +46 70 595 39 35
/ <a href="http://www.giskraft.se" target="_blank">www.giskraft.se</a></p></div></div></div></div></div></div></div></span></div></div></div></div></div>
_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr"><div dir="ltr"><div>Alessandro Pasotti</div><div>QCooperative:  <a href="https://www.qcooperative.net" target="_blank">www.qcooperative.net</a><br></div>ItOpen:   <a href="http://www.itopen.it" target="_blank">www.itopen.it</a></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><p><b><img src="https://drive.google.com/uc?id=1sRHl_CnQrtHqnEvCnblOPhzklqxxeH5J&export=download"><br></b></p><p><b>GisKraft</b>, Geodatakonsult</p><p>Mats Elfström,
Marsvinsholms stationsväg 80, 271 93 Ystad, Sweden<br>tel: +46 70 595 39 35
/ <a href="http://www.giskraft.se" target="_blank">www.giskraft.se</a></p></div></div></div></div></div></div></div></span></div></div></div></div></div>