[GIS] QGIS Web Client installation procedure

apacheqgisqgis-serverqgis-web-client

I have QGIS Server up and running and can successfully load WMS layers back into QGIS. I am attempting to set up the QGIS Web Client. Procedure: https://github.com/qgis/qgis-web-client

I am having difficulties with the install.

I run:

  cd /etc/apache2/sites-available/
  ln -s <path to apache-conf/qgis-web-client.conf> .
  sudo a2enmod rewrite
  sudo a2ensite qgis-web-client.conf
  sudo /etc/init.d/apache2 reloadad

My whole Apache server seems to die, WMS layers stop working through QGIS and localhost in browser brings up "Unable to connect".

qgis-web-client.conf file looks like this:

<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 localhost

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

  ScriptAlias /cgi-bin/ /home/ben/qgis-web-client/cgi-bin/
  <Directory "/home/ben/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>

I tried editing my host file as line 3 suggests but it makes no difference.

Removing the symlink to qgis-web-client.conf repairs apache and server starts working again.

In addition, when it asks

Check the QGIS libs are in your /etc/ld.so.conf path

I don't really know what I am checking. A little more info here would be great.

Best Answer

a few hours later I found my problem:

I discovered apache logs at /var/log/apache2/error.log. An error read "(2)No such file or directory: apache2: could not open error log file /etc/apache2/${APACHE_LOG_DIR}/qgis-web-client-error.log. Unable to open logs".

So I searched my qgis-web-client.conf for this line and found it and added the directory to the apache log files. So simple yet so much wasted time!

Related Question