Monday 19 December 2016

Qgis server on Ubuntu Server 14.04: Permission denied


I'm trying to install and configure Qgis Server (2.0.1) on a virtual server with ubuntu 14.04, Apache 2.4.7. After trying to install normally, the server gave me 404 error, so I tried to add configuration to /etc/apache2/sites-available/000-default.conf following different code snippets, but each try result in a 403 error (permission denied), testing for example an url like "/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&REQUEST=GetCapabilities" What are the correct steps to configure Qgis?



Answer



Here my usual steps to configure wms di qgis (2.4) tested on ubuntu 12.04 and 14.04


1) Install some requested packages:


sudo apt-get install qgis-mapserver libapache2-mod-fcgid

2) Be sure fastcgi is enabled in apache2 modules:


ls -la /etc/apache2/mods-enabled/fcgid.conf


2a) Modify /etc/apache2/sites-available/000-default.conf and add inside VirtualHost: ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ Options ExecCGI FollowSymLinks Require all granted AddHandler fcgid-script .fcgi


3) Restart apache2 http server


sudo service apache2 restart

4) Try to access to service using a browser type:


http://127.0.0.1/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&REQUEST=GetCapabilities

5) Try a qgis project in your user dirs:


/home/ubuntu/my_qgis_project_dir/my_qgis_project.qgs



Still using a browser verify the web address (note the MAP has an absolute path to the project, otherwise you'll get a 500 error):


http://127.0.0.1/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&MAP=/home/ubuntu/my_qgis_project_dir/my_qgis_project.qgs&REQUEST=GetCapabilities  

6) Use qgis (or also other client software) add the WMS service


Qgis menu: Layer → Add layer WMS/WMTS layer


simply add the http addr above... connect to service and add desired layers




If you get 403 errors please verify your dir $HOME permissions mine are drwxr-xr-x and also some apache2 conf:


http://www.cyberciti.biz/faq/apache-403-forbidden-error-and-solution/


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...