Coincidence? Just today I upgraded from MapServer 7.x.y to 8.0.0 in the Docker Image I provide [1] and found that the configuration conventions have changed as per the docs.

Indeed MAPSERVER_CONFIG_FILE env var should point to a global config file, which in turn points to .map file(s). There are many ways to set an environment variable dependent on your context, but if it is available where MapServer is invoked, like with CGI that should work. I don't think there is a single solution. /etc/environment is very global unless the machine is dedicated or personal.

In my case running MapServer via Docker, which I can recommend, MAPSERVER_CONFIG_FILE can be set with an -e option or as an env var in a Compose file.

The Docker Image uses Lighttp to invoke MS with CGI, which IMHO is a more lightweight solution than using Apache or nginx. Especially if you run multiple services behind a single frontend server (I use e.g. Traefik).

[1] https://github.com/justb4/docker-mapserver

Best,

Just van den Broecke

On 28/05/2024 08:50, Richard Duivenvoorde via MapServer-users wrote:
I was in the same position :-)

What I did on my laptop (running apache):

In apache.conf you can set it by using:

SetEnv MAPSERVER_CONFIG_FILE /opt/mapserver/mapserver.conf

If you use Nginx though (which apparently lacks env variables) I used:

https://gist.github.com/lhammond/f59d8db526101e9896d0c9bdd8f15139

https://mkliver.github.io/blog/mapserver-ubuntu-nginx

But maybe others have better solutions...

Regards,

Richard Duivenvoorde



On 5/28/24 02:52, Brent Wood via MapServer-users wrote:
Hi,

I'm coming back to mapserver after many years away & have a question. Probably more later...

I'm setting things up & get the error message:
/msLoadConfig(): Unable to access file. See mapserver.org/mapfile/config.html for more information.
/
/
/
I'm running on Linux Mint (Ubuntu) so the default location is presumably /usr/local/etc/mapserver.conf

I have copied/renamed the sample file here & given read access to www-data. Still get the error message.

The docs suggest using the MAPSERVER_CONFIG_FILE environment variable.

I entered the following into the /etc/environment file, which I thought was supposed to work (according to Dr Google),
MAPSERVER_CONFIG_FILE="/usr/local/etc/mapserver.conf"

I still get the error, and if I open a new shell (as me), the variable is not set, so that isn't working as I expected.


Can anyone suggest how/where the environment variable should be set for mapserver to find the file?
(or any other way to get this working)

I think it would be useful to include this info in the docs, as it is not apparent to me, and perhaps others.


_______________________________________________
MapServer-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users

_______________________________________________
MapServer-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users

_______________________________________________
MapServer-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to