1

I'm installing QGIS Web Client following these instructions on windows 7.

Problem When trying to access 'http://localhost/web/site/qgiswebclient.html?map=C:/OSGeo4W/apache/htdocs/web/projects/helloworld.qgs' the web client loads but hangs at 'Loading Map'. In the browser developer console I'm getting the error:

XMLHttpRequest cannot load file:///C:/OSGeo4W/app/qgis/bin/qgis_mapserv.fcgi?map=C:/OSGeo4W/apache/htdocs/web/projects/helloworld.qgs&&_dc=1475068443365&SERVICE=WMS&VERSION=1.3&REQUEST=GetProjectSettings

But GetCapabilities returns the un-styled xml without issue...

What I've tried

All the references to /home/web/qgis-web-client/ in GlobalOptions.js and index.html etc have been changed to C:\OSGeo4W\apache\htdocs\web\projects.

.exe has been removed from qgis_mapserv.fcgi.exe to create qgis_mapserv.fcgi.

Project CRS set to EPSG:3857in GlobalOptions.js

In httpd.conf I've changed:

ScriptAlias /cgi-bin/ "C:\OSGeo4W/bin/" to ScriptAlias /cgi-bin/ "C:\OSGeo4W/apps/qgis/bin/"

I've tried all the QGIS Web Client questions including these:

How to setup QGIS Web Client?

qgis-web-client stuck on Loading Map

QGIS Web Client in Windows does not load map

  • A working web server is already a good sign. Setting up the client should be a walk in a park after that. There are some things you can still try. You could try replicating the request the same way your client does. So it depends on your conf file but usually its like this: localhost/qgis/qgis_mapserv.fcgi?map=full/path/to/project.qgs&SERVICE=WMS&VERSION=1.3&REQUEST=GetProjectSettings. Now if you still get the same result -> file not there, then it must be either file is not there or the server does not have enough rights to access the file. – Piskr Sep 30 '16 at 6:56
  • I did a quick recheck, If you have a working GetCapabilities request, then the server has access to the file. So it must be the file cannot be found. Also you shouldn't change ScriptAlias /cgi-bin/ "C:\OSGeo4W/bin/", you should leave it as it is. If you want to change your path to your .fcgi then you do that in C:\OSGeo4W\http.d\httpd_*.conf. – Piskr Sep 30 '16 at 7:23
1

Because you changed the ScriptAlias in httpd.conf, to the qgis one, most of the functions needed for qgis to work were not loaded. Therefore your project could not be loaded. If you change it back to the old definition

ScriptAlias /cgi-bin/ "C:\OSGeo4W/bin/"

It should work.

Inside the folder C\OSGeo4W\http.d\ you should see a file named httpd_qgis.conf and it contains other definitions for the apache conf. This is how my file looks like:

LoadModule fcgid_module modules/mod_fcgid.so
#needed for the .fcgi to work
DefaultInitEnv PATH "C:\OSGeo4W\bin;C:\OSGeo4W\apps\qgis\bin;C:\OSGeo4W\apps\grass\grass-@grassversion@\bin;C:\OSGeo4W\apps\grass\grass-@grassversion@\lib;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"
#enviroment path for new gis functions we installed
DefaultInitEnv QGIS_PREFIX_PATH "C:\OSGeo4W\apps\qgis"
#path to qgis folder and its plugins
DefaultInitEnv QT_PLUGIN_PATH "C:\OSGeo4W\apps\qgis\qtplugins;C:\OSGeo4W\apps\qt4\plugins"
DefaultInitEnv TEMP "C:\Users\User\AppData\Local\Temp"

#alias for the folder where .fcgi is contained
Alias /qgis/ C:\OSGeo4W/apps/qgis/bin/
#alias needed if you want to use searching functions (needs to be configured)
Alias /wsgi/ C:\OSGeo4W/wsgi/

<Directory "C:\OSGeo4W/wsgi/">
 SetHandler wsgi-script
 Options ExecCGI
 Order allow,deny
 Allow from all
</Directory>

<Directory "C:\OSGeo4W/apps/qgis/bin/">
 SetHandler fcgid-script
 Options ExecCGI
 Order allow,deny
 Allow from all
</Directory>

The alias /qgis/ is for when you call the .fcgi file, so instead of localhost/full/path/to/my/qgis_mapserv.fcgi, its called with localhost/qgis/mapserv.fcgi. This same alias is then used in the GlobalProjectSettings.js at line

var serverAndCGI = "/qgis/qgis_mapserv.fcgi";

Which points to your webserver used by the qgis web client.

  • This worked, although not until I swapped from Opera 40.0. – user3725599 Sep 30 '16 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.