My question is not very clear but I will try to explain it.. When we call a wms layer from geoserver in Qgis for example we write http://adresse/geoserver/wms? and we find all layers which we have published.. I'd like to do the same: write a mapserver_adresse and get layers which I publish with mapserver (I do not want to write the mapfile name in the adresse).. Is-it possible and where I should start? Thanks
1 Answers
0
votes
You have to write a script in the same location in which is the executable mapserv. In this script you set the variable MS_MAPFILE=/path/your/mapfile and than execute mapserv.
On Linux this would look so:
#! /bin/bash
export MS_MAPFILE=/path/your/mapfile
./mapserv
Do not forget the #! /bin/bash, otherwise mapserver will refuse to work.
Save this script in the same location where is mapserv and make it executable, i.e:
chmod +x /usr/lib/cgi-bin/your_script
Now you can use it as a wms server in qgis with this address:
http://address/cgi-bin/your_script?
If you want to hide the "cgi-bin" part as well, can do it with apache.
See also all other environment variables which are recognized by mapserver:
https://trac.osgeo.org/mapserver/wiki/EnvironmentVariables
On Windows with Apache you can do the same using a SetEnvIf Directive like:
SetEnvIf Request_URI "/cgi-bin/exemplars/BGS_Bedrock_Geology/wms" MS_map file=/ms4w/apps/cookbookExemplars/BGS_Bedrock_Raster_Map/onegeology.map