4

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?

  • I have been attempting to configure the QGIS server for some time now with no luck. After reading this post I tried what was detailed above but got the following, After I typed: ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin/"> Options ExecCGI FollowSymLinks Require all granted AddHandler fcgid-script .fcgi </Directory> I get this:bash: syntax error near unexpected token `newline' I took out the brackets and typed: ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ Directory "/usr/lib/cgi-bin/" Options ExecCGI FollowSymLinks Require all granted AddHandler fcg And then I get this: Sc – user35678 Aug 12 '14 at 2:02
  • Seems a problem in how you write the apache configuration... – sabas Aug 12 '14 at 7:28
  • Excellent set of instructions. I am almost there.. was able to see my WMS layer listed from another machine (client). Though it did not get loaded in QGIS. There was a message at the bottom of "add layer from WMS Server" window saying... "No common CRS for selected layer". I think when i save the qgs file, i need to make sure the CRS is first set to 4326 and then the qgs file is saved. Will try that and post my result. Nevertheless the set of instructions are very useful! – abhijit ekbote May 17 '15 at 17:09
6

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/ <Directory "/usr/lib/cgi-bin/"> Options ExecCGI FollowSymLinks Require all granted AddHandler fcgid-script .fcgi </Directory>

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/

  • I edited a bit to add a configuration step on which I lost various hours – sabas Aug 11 '14 at 7:26
  • Is there some way to prevent a browser from downloading fcgi file? I can't get through 4th point of your guide. – Filip Hazubski Feb 3 '16 at 14:04
  • Nevermind. I have figured that out. If fastcgi is not enabled and the command from the 2nd point gives you error about missing file here is the solution: create a soft link of two files: /etc/apache2/mods-available/fcgid.conf and /etc/apache2/mods-available/fcgid.load and move them to /etc/apache2/mods-enabled/. You will need root permissions. – Filip Hazubski Feb 3 '16 at 14:17
  • You should extend your question detailing how to enable FastCGI since it is disabled by default. – Luís de Sousa Jul 8 '16 at 14:30

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.