https://www.apachelounge.com/download/VC15/binaries/httpd-2.4.37-win64-VC15.zip
https://www.apachelounge.com/download/VC15/modules/mod_fcgid-2.3.9-win64-VC15.zip
https://aka.ms/vs/15/release/VC_redist.x64.exe
http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86_64.exe
webserver
, also z.B. C:\webserver
.https://www.apachelounge.com/download/
, s.o.Apache24
-Ordners aus httpd-2.4.37-win64-VC15.zip, um diesen ins vorbereitete Webserver-Verzeichnis zu schieben (→ z.B. C:\webserver\Apache24
)mod_fcgid.so
aus dem Verzeichnis mod_fcgid-2.3.9 in das \Apache24\modules
-Verzeichnis\Apache24\conf\httpd.conf
(hier: C:\webserver\Apache24\conf\httpd.conf
). Öffnen der Datei in einem fähigen Texteditor (ich verwende z.B. notepad++) und folgende Änderungen vornehmen:SRVROOT
: Ersetzen von c:/Apache24
durch c:/webserver/Apache24
überall wo es vorkommt — bzw. entsprechend der getroffenen VoreinstellungenServerName
weiter unten sollte in unserem Beispiel ServerName localhost:80
, sofern der Standardport 80 verwendet wird/werden soll, ansonsten eben eine andere Portnummer (z.B. 90)ServerName
-Zeile aktivieren („uncomment“), indem das vorstehende #
-(Kommentar-)Zeichen entfernt wirdwww.example.com:80
durch localhost:80
ersetzenListen 80
steht. Es ist ein Port zu verwenden, der auf dieser Maschine nicht schon von einem anderen Dienst/service verwendet wird!httpd.exe
ausführen. Entweder verwendet man die Windows Konsole (CMD) dafür, oder man wechselt in das entsprechende Verzeichnis und führt httpd.exe
„als Adminsitrator“ aus.\Apache24\bin
-Verzeichnis, Rechtsklick auf httpd.exe
→ „Als Adminsitrator ausführen“http://localhost
bzw. http://localhost:port eingibt, sollte eine Webseite ercheinen, auf der „It Works!“ steht, was bedeutet, das der Apache korrekt installiert ist.httpd.exe -k install
http://localhost
bzw. http://localhost:port wieder „It Works!“ gezeigt werdenhttpd.exe -k restart
bzw. httpd.exe -k shutdown
httpd.conf
) um benötigte Module einzuschalten (→ C:\webserverApache24\conf\httpd.conf
)#
-Zeichens am Zeilenanfang, um die benötigten Module zu aktivierenmod_fcgid.so
(s.u.)LoadModule actions_module modules/mod_actions.so LoadModule deflate_module modules/mod_deflate.so LoadModule expires_module modules/mod_expires.so LoadModule ext_filter_module modules/mod_ext_filter.so LoadModule fcgid_module modules/mod_fcgid.so LoadModule headers_module modules/mod_headers.so LoadModule ident_module modules/mod_ident.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule ssl_module modules/mod_ssl.so LoadModule fcgid_module modules/mod_fcgid.so
Hinweis: Wenn ein anderer als der Standardport 80 verwendet wird, müssen auch noch folgende Module aktiviert werden:
LoadModule cache_module modules/mod_cache.so LoadModule cache_disk_module modules/mod_cache_disk.so LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_connect_module modules/mod_proxy_connect.so LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so LoadModule proxy_http_module modules/mod_proxy_http.so
<IfModule mod_deflate.c> SetOutputFilter DEFLATE BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\\.0[678] no-gzip BrowserMatch \\bMSIE !no-gzip !gzip-only-text/html SetEnvIfNoCase Reuqest_URI \\.(?:gif|jpe?g|png|rar|zip)$ no-gzip dont-vary Header append Vary User-Agent env=!dont-vary </IfModule>
Ich bevorzuge die Installation mittels OSGeo4W-Netzwerkinstallation, die nach dem Download im Modus „Fortgeschrittene Installation“ eine übersichtliche Auswahl aller zur Verfügung stehenden Pakete bietet.
Für dieses Beispiel wird QGIS 3.4.5 LTR verwendet (der erste LTR aus dem OSGeo4W-LTR-Repository).
C:\OSGeo4W64
beibehaltenqgis-ltr-server
QGIS Server (long term release) → aktuelle Version: 3.4.5-1C:\webserver\Apache24\conf\httpd.conf
die Zeile Include conf/extra/httpd-vhosts.conf
un-kommentieren, also das führende #-Zeichen entfernen.httpd-vhosts.conf
-Datei öffnen und editieren (→ C:\webserver\Apache\Conf\extra\httpd-vhosts.conf
)<VirtualHost *:80> ServerName localhost:80 # qgs-Deployment DocumentRoot "C:/webserver/qgis_ows/qgs/" <Directory "C:/webserver/qgis_ows/qgs/"> Options -Indexes +FollowSymLinks +ExecCGI AllowOverride All Require all granted </Directory> Alias /qgis/ "C:/OSGeo4W64/apps/qgis-ltr/bin/" <Directory "C:/OSGeo4W64/apps/qgis-ltr/bin/"> SetHandler fcgid-script Options +ExecCGI AllowOverride All Require all granted </Directory> # FIXME wofür? Alias /document/ "C:/webserver/qgis_ows/document/" <Directory "C:/webserver/qgis_ows/document"> Options -Indexes +FollowSymLinks AllowOverride All Require all granted </Directory> # Apache logs (different than QGIS Server log) CustomLog "logs/qgis-access.log" combined ErrorLog "logs/qgis-error.log" </VirtualHost>
VirtualHost
-Konfiguration in httpd-vhosts.conf
noch folgende Variablen einfügen und zwar oben zwischen <VirtualHost *:80>
und ServerName localhost:80
FcgidInitialEnv PATH "C:\OSGeo4W64\bin;C:\OSGeo4W64\apps\qgis-ltr\bin;C:\OSGeo4W64\apps\Qt5\bin;C:\OSGeo4W64\apps\grass\grass-6.4.3\lib;C:\OSGeo4W64\apps\grass\grass-6.4.3\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\WBem" FcgidInitialEnv QT_PLUGIN_PATH "C:\OSGeo4W64\apps\qgis-ltr\qtplugins;C:\OSGeo4W64\apps\Qt5\plugins" FcgidInitialEnv PYTHONHOME "C:\OSGeo4W64\apps\Python37" FcgidInitialEnv PYTHONPATH "C:\OSGeo4W64\apps\qgis-ltr\.\python;C:\OSGeo4W64\apps\qgis-ltr\.\python\plugins;C:\OSGeo4W64\apps\Python37\DLLs;C:\OSGeo4W64\apps\Python37\lib;C:\OSGeo4W64\bin;C:\OSGeo4W64\apps\Python37;C:\OSGeo4W64\apps\Python37\lib\site-packages" FcgidInitialEnv QGIS_SERVER_LOG_LEVEL 0 FcgidInitialEnv QGIS_SERVER_LOG_FILE "C:\\webserver\\Apache24\\logs\\qgis_server.log" FcgidIOTimeout 120 FcgidInitialEnv LC_ALL "en_US.UTF-8" FcgidInitialEnv PYTHONIOENCODING UTF-8 FcgidInitialEnv LANG "en_US.UTF-8" FcgidInitialEnv QGIS_DEBUG 1 FcgidInitialEnv QGIS_PLUGINPATH "C:\OSGeo4W64\apps\qgis-ltr\python\plugins" SetEnvIf Request_URI ^/qgis QGIS_PREFIX_PATH "C:\OSGeo4W64\apps\qgis-ltr" SetEnvIf Request_URI ^/qgis TEMP "C:\Windows\Temp" SetEnvIf Request_URI ^/qgis GDAL_DATA "C:\OSGeo4W64\share\gdal" SetEnvIf Request_URI ^/qgis GDAL_DRIVER_PATH "C:\OSGeo4W64\bin" SetEnvIf Request_URI ^/qgis PDAL_DRIVER_PATH "C:\OSGeo4W64\bin" SetEnvIf Request_URI ^/qgis GDAL_SKIP "JP2ECW" SetEnvIf Request_URI ^/qgis PROJ_LIB "C:\OSGeo4W64\share\proj"
httpd-vhosts.conf
speichernhttp://localhost/qgis/qgis_mapserv.fcgi.exe?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
wms_metadata.xml
zeigen. Das bedeutet dann, dass QGIS Server richtig installiert worden ist und als fcgi angesprochen wird. Wenn die Anzeige im Browser so oder so ähnlich aussieht, hat die Installation geklappt. (Die Hauptsache ist, dass ein beschreibender Text über den WMS erscheint und keine Fehlermeldung.)
.qgs
) in das Serververzeichnis C:/webserver/qgis_ows/qgs/
abzulegen.http://localhost/qgis/qgis_mapserv.fcgi.exe?MAP=C:/webserver/qgis_ows/qgs/test_wms.qgs