[mapserver-users] nginx/fastcgi/mapserver

Peter Maes thxftw at gmail.com
Fri May 11 02:32:50 PDT 2012


Hi,

Thanks again for your answer Thomas.

I have seen that issue report and I am using mapserver latest version
(6.0.2 (which is what you meant? or is there an actual 6.2 somewhere)

It does indeed keep working if i reference a good map and hammer F5.

Although: when i for instance call a wrong mapfile and hammer that it will
also kill the processes. Is there a workaround for this? Otherwise people
can just execute denial of service attacks on my mapserver.

We're already using nginx for static file hosting. It would be great if i
could get a production ready mapserver environment there as well.


2012/5/11 thomas bonfort <thomas.bonfort at gmail.com>

> You might want to have a look at
> https://github.com/mapserver/mapserver/issues/3099
>
> tl;dr
>  - mapserver fastcgi calls exit() when running in an error condition,
> which causes some fastcgi spawning managers to have issues
>  - mapserver 6.2 (current git master) has been refactored to greatly
> minimize the exit() occurences (basically only on memory allocation
> errors)
>
> --
> thomas
>
> On Fri, May 11, 2012 at 10:42 AM, Peter Maes <thxftw at gmail.com> wrote:
> > Hello,
> >
> > I'm trying to run mapserver on nginx (fastcgi), but after 2 days booked
> > little success.
> >
> > 1. I've compiled mapserv with fastcgi support and validated this
> > 2. I created a spawn-fcgi startup script based on this
> > : http://osgeo-org.1560.n6.nabble.com/Mapserver-on-nginx-td4226669.html
> >
> > It now looks like this:
> > ----
> > #!/bin/sh
> > MAPSERV_PORT=9001
> > USER=www-data
> > DAEMON=/usr/local/bin/mapserv
> > CHILDREN=5
> >
> > # the -F switch of spawn-fcg does not work when the -n swich
> > # is set. using multiwatch instead
> > # see http://manpages.ubuntu.com/manpages/lucid/man1/spawn-fcgi.1.html
> >
> > exec setuidgid $USER spawn-fcgi \
> >   -a 127.0.0.1 \
> >   -p $MAPSERV_PORT \
> >   -u $USER \
> >   /usr/bin/multiwatch -f $CHILDREN $DAEMON
> > ----
> >
> > In Nginx its called like this:
> >
> >        location /mapserver/ {
> >                 include /etc/nginx/fastcgi_params;
> >                 fastcgi_pass 127.0.0.1:9001;
> >
> >                 fastcgi_param SCRIPT_FILENAME /usr/local/run/spawnscript;
> >                 fastcgi_param PATH_INFO /usr/local/run/ spawnscript;
> >         }
> >
> > When i try to connect to /mapserver in my browser, i get an error stating
> > 502 Bad gateway.
> >
> > So i tried starting the spawn script
> manually: /usr/local/run/spawnscript .
> > When i then try to connect using browser it works fine for a short
> while. On
> > the console it logs this error:
> > Spawing child[0] failed, next try
> > Child[1] died, respawn
> > Child[2] died, respawn
> > Child[3] died, respawn
> > Child[4] died, respawn
> > Child[0] died, respawn
> > Spawing child[1] failed, next try
> > Spawing child[2] failed, next try
> > Spawing child[3] failed, next try
> > Spawing child[4] failed, next try
> > Spawing child[0] failed, next try
> > Spawing child[1] failed, next try
> > Spawing child[2] failed, next try
> > Spawing child[3] failed, next try
> > Spawing child[4] failed, next try
> > Spawing child[0] failed, next try
> > Spawing child[1] failed, next try
> > Spawing child[2] failed, next try
> > Spawing child[3] failed, next try
> > Spawing child[4] failed, next try
> > Spawing child[0] failed, next try
> > Spawing child[1] failed, next try
> > Child[1] died to often, not forking again
> > Spawing child[2] failed, next try
> > Child[2] died to often, not forking again
> > Spawing child[3] failed, next try
> > Child[3] died to often, not forking again
> > Spawing child[4] failed, next try
> > Child[4] died to often, not forking again
> > Spawing child[0] failed, next try
> > Child[0] died to often, not forking again
> >
> > After which the process exits and I revert to the 502 Bad gateway.
> >
> > What am I missing here? :).
> >
> > Thanks for any tips. I'm not that experienced with spawn-fcgi.
> >
> >
> >
> > _______________________________________________
> > mapserver-users mailing list
> > mapserver-users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapserver-users
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120511/69f8c501/attachment.htm>


More information about the MapServer-users mailing list