I've installed QGIS server and it works fine. I've put qgs file in the server folder dir and using "Add WMS layer" from QGIS I manage to view the qgs file.

This is how I use GetCapabilities for example: http://www.localhost.com/qgis/qgis_mapserv.fcgi.exe?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities&map=D:/OSGeo4W/apps/qgis/bin/MyLondon.qgs&

Now my problem is that in all OpenLayers WMS examples, adding WMS layer looks like this:

layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
          {layers: 'basic'}

How do I convert my WMS to this format? Where in the URL I set the project name and where the layer name?

  • The URL should include the map=value& parameter
    – nmtoken
    Sep 20, 2018 at 11:10

2 Answers 2


I've posted a solution that works for me on http://underdark.wordpress.com/2012/03/30/qgis-server-on-ubuntu-step-by-step/. Adjusted to your information, it would be something like:

wms = new OpenLayers.Layer.WMS(
'london_basic', "http://www.localhost.com/qgis/qgis_mapserv.fcgi.exi",
    layers: 'basic', 
    format: 'image/png',
    map: 'D:/OSGeo4W/apps/qgis/bin/MyLondon.qgs',
    buffer: 1, 
    isBaseLayer: true, 
    graphicZIndex: 0, 
  • Thank you , is there a way to configure my qgis server to be more URL friendly like the example I've posted ?
    – Alophind
    Jan 27, 2013 at 17:31
  • Anita , in your Vienna example u didn't write use map name , how come ?
    – Alophind
    Jan 27, 2013 at 17:34
  • I had only one project in the same folder, so it automatically used that one. Sorry, but what do you mean by URL friendly?
    – underdark
    Jan 27, 2013 at 20:50
  • I meant be able to use url vmap0.tiles.osgeo.org/wms/vmap0 instead of the entire QGIS settings
    – Alophind
    Jan 28, 2013 at 8:17
  • Btw , this still doesnt work for me. I see white rectangle while QGIS does show me the 3 layers inside my project (from the WMS)
    – Alophind
    Jan 28, 2013 at 8:51

The map parameter is part of the service endpoint URL, so the syntax would be like:

layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
    {layers: 'basic'}

To convert to a more friendly endpoint URL like http://localhost/qgis/qgis_mapserv.fcgi.exe? add a SetEnvIf parameter to your Apache config, something like:

SetEnvIf Request_URI "/qgis/qgis_mapserv.fcgi.exe" MS_MAPFILE=D:/OSGeo4W/apps/qgis/bin/MyLondon.qgs
  • Interesting. I am experiencing similar problems as the OP. Will try this later.
    – umbe1987
    Nov 12, 2018 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.