[mapserver-users] nginx/fastcgi/mapserver

Peter Maes thxftw at gmail.com
Fri May 11 01:42:58 PDT 2012


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120511/24906e66/attachment.htm>


More information about the MapServer-users mailing list