Let’s try to setup brand new QGIS Server 3.0 on Windows 10 and Apache Web Server.
Apache
Download XAMPP distribution (you will also install PHP, probably you need it anyway). You can remove all other options as only installing Apache and PHP.
Test for Apache and PHP
QGIS Server 3.0
Download 64 bit OSGeo4W installer . Choose advanced installation, from web and then select QGIS Server from Web part. I also needed QGIS Desktop on that machine so I checked also QGIS Desktop.
Apache configuration
Edit httpd.conf
file. In case of XAMPP you get Control Panel where it is really simple to do that.
ScriptAlias
change line:
ScriptAlias /cgi-bin/ "C:/xampp/cgi-bin/"
to:
ScriptAlias /cgi-bin/ "c:/OSGeo4W64/apps/qgis/bin/"
QGIS Server configuration
change part:
<Directory "C:/xampp/cgi-bin"
AllowOverride None
Options None
Require all granted
</Directory>
to:
<Directory "c:/OSGeo4W64/apps/qgis/bin">
SetHandler cgi-script
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
Require all granted
</Directory>
Cgi handler
change line:
AddHandler cgi-script .cgi .pl .asp
to:
AddHandler cgi-script .cgi .pl .exe
Variables
insert at bottom of http.conf:
SetEnv GDAL_DATA "C:\OSGeo4W64\share\gdal" SetEnv QGIS_AUTH_DB_DIR_PATH "C:\OSGeo4W64\apps\qgis\resources" SetEnv PYTHONHOME "C:\OSGeo4W64\apps\Python36" SetEnv PATH "C:\OSGeo4W64\bin;C:\OSGeo4W64\apps\qgis\bin;C:\OSGeo4W64\apps\Qt5\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem" SetEnv QGIS_PREFIX_PATH "C:\OSGeo4W64\apps\qgis" SetEnv QT_PLUGIN_PATH "C:\OSGeo4W64\apps\qgis\qtplugins;C:\OSGeo4W64\apps\Qt5\plugins"
That completes Apache configuration.
Test
Restart Apache server (from XAMPP Control Panel) and open a GetCapabilities request to QGIS Server
http://localhost/cgi-bin/qgis_mapserv.fcgi.exe?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
You should receive standard WMS Capabilities XML response from QGIS Server.
[…] http://level2.si/2018/03/qgis-server-3-0-on-windows-10/ […]
What about fcgid_module?
That should be it. Describe the problem if it doesn’t work for you.
Hi! Thank you very much!! I was stuck because I didn’t add the environment variables. Thanks a lot!
Thanks a lot Uroš you are a champion. Much appreciate it mate!
Hi, if you execute the qgis_mapserver.fcgi program in the command line window, do you get any errors? When I try your tutorial I get an error message complaining about the sip module.
Hi,
I updated my Windows Server 2012 with QGIS 3.4 and from above I only had to change this line
SetEnv PYTHONHOME “C:\OSGeo4W64\apps\Python36”
To this
SetEnv PYTHONHOME “C:\OSGeo4W64\apps\Python37”
and it’s working. I will update text above now. Running qgis_mapserv.fcgi.exe directly doesn’t work. It gives me libfcgi.dll missing error.
Typically. I get stuck as the system cannot find the qgis.pyqt module, probably because I have not installed the desktop version first, as you have. WMS works though and I actually use IIS instead of apache 🙂
So, WMS is working, where does it stuck, then, at GetCapabilities? In my case I have QGIS Desktop together with Server, but normally I have only QGIS Server installed, so that should not be issue. Don’t know what exactly what is not working for you, but looks like you have special case different then described in this post. It would be very interesting to know how you managed to run it on IIS and how is the performance. Have some hints for IIS, maybe I will try it out.
Installing GQis desktop solves the issues with pyqt. I folloed the windows install instructions for Mapserver to get QGis to serve a qgs-file via WMs but for the moment I cant replicate it. Performance I cannot tell as I do my tests on a small amazon lightsail instance
Hallo, kann mir bitte jemand sagen, wie ich fertige Qgs Projekte auf der localhost-seite bereitstelle? Es wird mir immer nur dieses angezeigt : Mit dieser XML-Datei sind anscheinend keine Style-Informationen verknüpft. Nachfolgend wird die Baum-Ansicht des Dokuments angezeigt.
So langsam bin ich echt verzweifelt.
Vielen Dank schon einmal
Hi,
Sorry I managed to translate it, but I have to respond in English. In general this is not easy setup task and you should have some background with web servers and system administration (besides GIS). I don’t have much information, I believe it is a problem with Apache configuration. You can view GetCapabilities XML document, URL from above Test?
Hello!
QGIS V3.4.4
I have any errors: Procedure entry point!
“?initEditors@QgsEditorWidjetRegistry@@SAXPEAVQgsMapCanvas@@PEAVEQgisMessageBar@@@Z” don’t find in DLL “C:\OSGeo4W64\apps\qgis\bin\qgis_mapserv.fcgi.exe”
qgis_mapserv.fcgi.exe wasn’t located in “C:\OSGeo4W64\apps\qgis\bin”. It was in “”C:\OSGeo4W64\apps\qgis-ltr-dev\bin” .
Hi
Thanks to your tutorial, I have QGIS sever 3 installed on windows 10, and I get a good response back from the Getcapabilities request. However, when i try to add server to QGIS 3 as a WMS data source, I get an error “internal server error”
any ideas on what that could be?
Hi,
Thanks for this tutorial, it made my day ! QGIS LTR works great on Windows 10.
Think changing ‘qgis’ for ‘qgis-ltr’ in all path from httpd.conf if you have installed QGIS-server LTR.
And if you want QGIS to open a default map, add SetEnv QGIS_PROJECT_FILE “C:/your/path/to/default/map” at the end of httpd.conf
Thanks again.
JK
Very good that it’s working for you. More than I can say for latest LTR release. I have windows for test and other servers run on Linux. Yes, this post was first made when LTR was 2.18, installing now should be as you pointed all paths as ‘qgis-ltr’. Anyway, can you share what is your setup different than described above. Does GetCapabilities call return you valid XML?
Hi Uroš,
at first, thanks for detailed step by step instructions to install qgis server! I have followed your hints and installed qgis-server (ltr version 3.4.8) on my Windows 7.
After some configurations changes, I managed to get responable response in my browser: http://zodiac.hostetin.org:90/cgi-bin/qgis_mapserv.fcgi.exe?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities&map=a.qgs
Unfortunately, when I try to get map, server returns error message: The requested map size is too large:
http://zodiac.hostetin.org:90/cgi-bin/qgis_mapserv.fcgi.exe?REQUEST=GetMap&map=a.qgs
Could you, please, give me any advice how to make server working?
hi,
Your GetMap request is not complete. Normally web client would add parameters like bounding box, size, crs, layers,…
Look here – https://docs.qgis.org/3.4/en/docs/user_manual/working_with_ogc/server/services.html#id25
Can you help me and explain what was your changes in setup to make QGIS Server running. For me it’s not working.
uroš
Hi,
as for the changes in setup:
since I have installed ltr version of qgis-server, I just replaced in httpd.conf all “…/qgis/bin/” with “…/qgis-ltr/bin/”.
Regarding my uncomplete GetMap request:
– sorry, I am completly newbie with QGIS server
– I thought that it will read properties from qgs project specified in &map=… parameter
– what are minimum required parameters to view a map successfully?
Thanks for the tutorial.
Followed it step by step on AWS with Windows2016 as a Windows server.
Using Apache for a while, so I only modified settings required in httpd.conf
However when running test at the end, I receiver the message: Object not found, Error 404
Verified all paths and all seem right.
help https://screenshot.net/pl/14ygyfl libfcig
Hello mr.Uroš Preložnik
Can u make same stepbystep tutorial how to setup client ?
Server part is ok, but i have no idea what to do next and how to setup qgis web client?
that is very good but instead of qgis musst write qgis-ltr
Hello, when I put Directory/Sethandler cgi-script : Order allow,deny and Allow from all, lines makes error to restart apache 2.4
Thank You very much for help