[GIS] Correct folders and conf settings for qgis-web-client with qgis-server

apacheqgisqgis-serverqgis-web-client

I have setup QGIS server using this guide sucessfully and would now like to setup qgis-web-client alongside it.

My QGIS server folder is: /usr/lib/cgi-bin

For qgis-web-client I have followed the qgis-web-client readme here and have cloned from github (as recommended) here:

/home/web/qgis-web-client

I am now stuck with editing the qgis-web-client.conf file to get things working correctly. I updated the path to "home/web/qgis-web-client/site" file. (See qgis-web-client.conf below for reference)

I think I am doing something wrong now and cannot understand the rest of the instructions in the readme. In particular:

  1. Check the symlink in cgi-bin is correct.
  2. Check the QGIS libs are in your /etc/ld.so.conf path
  3. Copy site/index.xml and check paths match your system OR
    Modify index.html and point your browser to that

Please can you tell me what is wrong with my configuration?

Please can you explain what the 3 points above mean?

Many thanks!

There seems to be many questions related to how to setup qgis-web-client and a lot of confusion. I have spent a lot of time scouring the gis stackexchange for the answer but so far have been unsuccessful!

<VirtualHost *:80>
ServerAdmin webmaster@localhost
# Add an entry to your /etc/hosts file for qgis-web-client.localhost e.g.
# 127.0.0.1 qgis-web-client.localhost
ServerName qgis-web-client.localhost

DocumentRoot /home/web/qgis-web-client/site
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/web/qgis-web-client/site/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /home/web/qgis-web-client/cgi-bin/
<Directory "/home/web/qgis-web-client/cgi-bin/">
AllowOverride None
Options +ExecCGI -MultiViews -SymLinksIfOwnerMatch
Order allow,deny
Allow from all
#Uncomment the next line to enable logging to a file
#SetEnv QGIS_LOG_FILE /tmp/qgislog.txt
</Directory>


# optional rewrite rules

# Forbid direct access
#  RewriteRule ^/cgi-bin/.*$ - [F]

# Search with SearchPanel

# sample search on layer 'Hello'
RewriteCond %{QUERY_STRING} ^(?:.*)query=samplesearch&*(?:.*)$
RewriteCond %{QUERY_STRING} ^(?:(?:.*)&)?colour=([^&]*)(?:.*)$
RewriteRule ^/wms/(.+)$ /cgi-bin/qgis_mapserv.fcgi?map=/<path-to-qgis-server-      projects>/$1.qgs&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&LAYERS=Hello&QUERY_LAYERS=Hello&FEATURE_COUNT=20&INFO_FORMAT=text/xml&SRS=EPSG:4326&FILTER=Hello:"colour"\ =\ '%1' [PT]

# Rewrite /wms/mapname to qgis_mapserv.fcgi?map=/<path-to-qgis-server-    projects>/mapname.qgs
RewriteRule ^/wms/(.+)$ /cgi-bin/qgis_mapserv.fcgi?map=/<path-to-qgis-server-projects>/$1.qgs [QSA,PT]
# Rewrite /maps/mapname to qgis-web-client main page. mapname will be extracted for wms calls in Javascript code.
RewriteRule ^/maps/([^\.]+)$ /qgis-web-client/site/qgiswebclient.html [PT]
# Rewrite /maps/* to qgis-web-client/site (e.g. /maps/gis_icons/mActionZoomNext.png -> /qgis-web-client/site/gis_icons/mActionZoomNext.png)
RewriteRule ^/maps/(.*) /qgis-web-client/site/$1 [PT]


ErrorLog ${APACHE_LOG_DIR}/qgis-web-client-error.log
CustomLog ${APACHE_LOG_DIR}/qgis-web-client-access.log combined

</VirtualHost>

Best Answer

Ok so after a lot of blindly changing settings I realise that my issue was probably primarily to do with my poor understanding of apache2, virtual hosts etc.

  1. I renamed the qgis-web-client folder to "map" and moved to: /var/www/html/

  2. Updated my qgis-web-client.conf file paths:

path-to-qgis-web-client = /var/www/html/map/

path-to-qgis-server-projects = /usr/lib/cgi-bin/mymapname/

  1. I can now reach my project at: http://MYIPADDRESS/map/site/qgiswebclient.html?map=/usr/lib/cgi-bin/MYMAPNAME

For some reason the map is zoomed in on Eastern Mali rather than the location specified by my project but at least I can access qgis-web-client - so I consider question answered

Related Question