[GIS] QGIS Server not working on CentOS 7

apachecentosqgisqgis-server

I installed QGIS Server via yumex on my CentOS 7.1 System and I have an Apache 2.4.6 Server running.

My Problem is, I can't show a QGIS project in my Chrome browser. Of cause, I read many instructions how to install QGIS Server and test it, but none of these worked for me.

My directories look like this:

Apache:

/var/www/cgi-bin/

/var/www/html/

/etc/httpd/conf/httpd.conf

QGIS:

/usr/bin/qgis

/usr/libexec/qgis/qgis_mapserv.fcgi

/usr/share/doc/qgis-server-2.8.2/wms_metadata.xml

I put a .qgs file in /var/www/html/wms/ where also are symlinks to qgis_mapserv.fcgi and wms_metadata.xml.

When I try to open my project via http://localhost/wms/My_project?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0 I got an Error:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<ServiceExceptionReport xmlns="http://www.opengis.net/ogc" version="1.3.0">
<ServiceException code="WMS configuration error">
There was an error reading the project file or the SLD configuration
</ServiceException>
</ServiceExceptionReport>

Best Answer

Probably, there is a problem from Apache to access the directory

/var/www/html/wms

I had the same error with myproject.qgs that was in a different directory:

/var/www/wms


The problem has been solved with insert of some directives in this configuration file:
/etc/httpd/conf.d/qgis-server.conf

RewriteRule ^/wms/(.+)$ /qgis/qgis_mapserv.fcgi?map=/var/www/wms/$1.qgs [QSA,PT]

Alias /wms/ "/var/www/wms"

<Directory "/var/wwww/wms">
    AllowOverride None
    Options None
    Require all granted
</Directory>

# This configuration is intended as an example. 
# It is not meant for productive use