[mapserver-users] MapServer as fast-cgi

Lars Lingner ml at lingner.eu
Sun May 30 10:47:24 EDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 30.05.2010 16:10, Kai Behncke wrote:
> Dear users,
> 
> 
> I try to set up Mapserver with fast-cgi, but so far it doesn`t work as it should do 
> (well I think it doesn`t, I`m also not so sure how to test ist).
> 
> * I have succesfully compiled MapServer 5.6.3 with fast-cgi (on Debian 5.0)
> 
> * Apache runs with mod_fcgid
> 
> * In the mapfile I have implemented in the layers  "PROCESSING "CLOSE_CONNECTION=DEFER"
> 
> But some steps I don`t understand:
> 
> In the apache-conf I set:
> 
> 
> 
> ScriptAlias /fcgi-bin/ "/etc/apache2/cgi-bin/mapserv"
> <Location "/fcgi-bin">
> Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
> SetHandler fcgid-script
> Order allow,deny
> Allow from all
> #FastCgiConfig -initial-env PROJ_LIB=/usr/share/proj -initial-env #LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/usr/local/pgsql/lib #-appConnTimeout 60 -idle-timeout 60 -init-start-delay 1  -minProcesses 2 #-maxClassProcesses 30 -startDelay 5
> 
> </Location>
> 
> 
> a) If I comment in FastCGIConfig ...... I always get from the Apache:
> "Invalid command 'FastCgiConfig', perhaps misspelled or defined by a module not included...." ??
> 
> What might be the reason for that?

Does Apache load the fcgid module?
You can check in /etc/apache2/mods-enabled if its enabled

and in /etc/apache2/mods-available if its installed

Or check the error.log of apache:
[Sun May 30 16:38:27 2010] [info] mod_fcgid: server
/var/www/clients/client1/web1/fcgi-bin/mapserv(21099) started


I have the following config:

ScriptAlias /fcgi-bin/ "/path/to/fcgi-bin/"

<Location "/fcgi-bin">
    SetHandler fcgid-script
    Options None
    Order allow,deny
    Allow from all
</Location>

my /etc/apache2/mods-enabled/fcgid.conf looks like this:

<IfModule mod_fcgid.c>
  AddHandler    fcgid-script .fcgi
  IPCConnectTimeout 20
</IfModule>



> 
> b) I start the Apache without the "FastCGIConfig" in the apache-conf-file
>  and I run the MapServer as:
> 
> http://www.xyz.de/fcgi-bin/?map=/path_to_my/mapfile.map
> 
> ...this should be the way to run MapServer as fast-cgi, shouldn`t it?

Hmm. I defined the scriptalias as path to the fcgi directory and not to
the binary. So the request URL is something like this:

http://example.org/fcgi-bin/mapserv?map...&...

But I don't know if your way might also be ok.


> 
> c) I thought, if I run MS with "Debug 5" the layers should be produced much faster, right?
> But the log-file doesn`t show any difference betwenn MS as cgi or fcgi, this might be because of
> the missing FastCgiConfig in Apache, right?
> 

With fcgi your MapServer processes will stay in memory. You should see
them within "top" even when the map is already delivered. And with
CLOSE_CONNECTION=DEFER you can then reuse database connections which in
turn will make your application faster.


Lars
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwCenEACgkQ0GRF77ebR/lSTACeO/vSeKLqQ1WphIb95/WqgZ3m
qOkAnjvmSo5NA1+6uE5b34RWOp7nZXPy
=lEMY
-----END PGP SIGNATURE-----


More information about the mapserver-users mailing list