Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://wiki.cmc.msu.ru/System/FastCGIEngineContrib?cover=print;rev=1
Дата изменения: Unknown Дата индексирования: Mon Apr 11 22:57:01 2016 Кодировка: |
.htaccess
(typically on host services)
mod_fcgid
or mod_fastcgi
FastCGIEngineContrib uses a CPAN library called FCGI which is not normally distributed with Perl. Version of FCGI should be 0.67 or later
Generic CPAN references as well as the most popular distribution packages are listed below
perl -MCPAN -e 'install FCGI'
)
There are two options that basicly do the same thing
It is difficult to recommend one or the other. In some cases one will work and the other will not. Most positive reports have been with mod_fcgidbut both have been tested and work with standard out-of-the-box Apache and Foswiki setups. mod_fcgid is easier to find as package because of its GPL license so it may be the best place to start. Fedora has mod_fcgid on the installation DVD now.
Below are some resources for the most common Linux distributions. The actual versions of the latest packages may have changed since this documentation was written.
mod_fcgid resourcesIt is strongly recommended that users work from Foswiki:Support.ApacheConfigGenerator to create initial Apache configurations. This config generator is comprehensive and well tested; the examples below may be inadequate for your needs.
.htaccess
.htaccess
file it's not possible to control the number of FastCGI processes, nor the user it'll be run with. We assume the webserver is configured to recognize files with .fcgi
extension to be FastCGI scripts. We also need mod_rewrite or mod_actions enabled.
Notes: Directory paths are relative to Foswiki root. Usage of mod_fcgid is assumed. If you're using mod_fastcgi, replacefcgid-script
withfastcgi-script
. mod_fcgid is preffered over mod_fastcgi. The latter project receives very few updates and has some known issues, such as Foswiki:Support.Faq18, whereasmod_fcgid
is a default module that is shipped with Apache httpd.
# bin/.htaccess file Options +ExecCGI RewriteEngine On # configure script is a special case, it must run as a CGI script: RewriteCond %{REQUEST_URI} !/configure # avoid loops: RewriteCond %{REQUEST_URI} !/foswiki.fcgi RewriteRule ^(.*) /foswiki/bin/foswiki.fcgi/$1 <Files configure> SetHandler cgi-script </Files>
# bin/.htaccess file Options +ExecCGI Action foswiki-fcgid /foswiki/bin/foswiki.fcgi SetHandler foswiki-fcgid <Files configure> SetHandler cgi-script </Files> <Files foswiki.fcgi> SetHandler fcgid-script </Files>
.htaccess
, such as: mod_fastcgi
: mod_fcgid
using a custom wrapper script with the FcgidWrapper directive and the virtual
flag
Consider using the newer and better-maintained mod_fcgid
which is shipped standard with Apache httpd.
We can use static or dynamic servers: static servers are initialized with Apache itself and exists as long Apache is running. Dynamic servers are loaded on demand and killed if the aren't needed anymore.
See mod_fastcgi documentation for more options.
# Simple and traditional example. Alias /foswiki/bin/configure /var/www/foswiki/bin/configure Alias /foswiki/bin /var/www/foswiki/bin/foswiki.fcgi # Commenting the next line makes foswiki to be a dynamic server, loaded on demand FastCgiServer /var/www/foswiki/bin/foswiki.fcgi -processes 3 <Directory /var/www/foswiki/bin> Options +ExecCGI <Files configure> SetHandler cgi-script </Files> <Files foswiki.fcgi> SetHandler fastcgi-script </Files> </Directory>Refer to tuning section below for a little discussion about the number of FastCGI processes.
# External server: could be running at another machine and/or a different user from the webserver Alias /foswiki/bin/configure /var/www/foswiki/bin/configure Alias /foswiki/bin /var/www/foswiki/bin/foswiki.fcgi # Running an external server on the same machine: FastCgiExternalServer /var/www/foswiki/bin/foswiki.fcgi -socket /path/to/foswiki.sock # Or at another machine: FastCgiExternalServer /var/www/foswiki/bin/foswiki.fcgi -host example.com:8080 <Directory /var/www/foswiki/bin> Options +ExecCGI <Files configure> SetHandler cgi-script </Files> <Files foswiki.fcgi> SetHandler fastcgi-script </Files> </Directory>When you're using external servers you must run the FastCGI processes manually:
$ cd /var/www/foswiki/bin # To start a pool of processes, listening to a local UNIX socket: $ ./foswiki.fcgi --listen /path/to/foswiki.sock --nproc 3 --pidfile /path/to/pidfile.pid --daemon # Or listening to a local :port address: $ ./foswiki.fcgi --listen :port --nproc 3 --pidfile /path/to/pidfile.pid --daemonRun
./foswiki.fcgi --help
for details on the options.
mod_fastcgi
: virtual
flag
# Simple and traditional example. Alias /foswiki/bin/configure /var/www/foswiki/bin/configure Alias /foswiki/bin /var/www/foswiki/bin/foswiki.fcgi <Directory /var/www/foswiki/bin> Options +ExecCGI <Files configure> SetHandler cgi-script </Files> <Files foswiki.fcgi> SetHandler fcgid-script </Files> </Directory>
ApacheLogin
instead of TemplateLogin
you'll need to add something like the following directives:
<LocationMatch "^/+foswiki/+bin/+(attach|edit|manage|rename|save|upload|.*auth|rest|login|logon)"> AuthType Basic AuthName "Foswiki login realm" AuthUserFile "/var/www/foswiki/data/.htpasswd" Require valid-user </LocationMatch>
# Example with FastCGI processes launched by the webserver $HTTP["url"] =~ "^/foswiki/bin/configure" { alias.url += ( "/foswiki/bin" => "/var/www/foswiki/bin" ) cgi.assign = ( "" => "" ) } $HTTP["url"] =~ "^/foswiki/bin/" { alias.url += ( "/foswiki/bin" => "/var/www/foswiki/bin/foswiki.fcgi" ) fastcgi.server = ( ".fcgi" => ( ( "socket" => "/var/www/foswiki/working/tmp/foswiki.sock", "bin-path" => "/var/www/foswiki/bin/foswiki.fcgi", "max-procs" => 3 ), ) ) }
# Example with external FastCGI processes (running on the same host, with another user or at a remote machine) $HTTP["url"] =~ "^/foswiki/bin/configure" { alias.url += ( "/foswiki/bin" => "/var/www/foswiki/bin" ) cgi.assign = ( "" => "" ) } $HTTP["url"] =~ "^/foswiki/bin/" { alias.url += ( "/foswiki/bin" => "/var/www/foswiki/bin/foswiki.fcgi" ) fastcgi.server = ( ".fcgi" => ( ( "host" => "example.com", "port" => "8080", ), ) ) }
.htaccess
file, it's possible to adjust the number of FastCGI processes. There is no magic number: it depends on some variables, like the hardware resources and access load. If you set this number too low, users may experience high latencies and you'll not use all hardware potential, on the other hand if this setting is adjusted too high then the server can be forced to use swap, what degrades performance a lot.
Dynamic servers are more useful when Foswiki access load on the server is low and/or it's used for something in addition to Foswiki. Under high loads, static servers can deliver better performance.
This is a persistent engine, so you need to restart the web server after some configuration update is performed. However, there is an auto-reload mechanism that apply changes without a web server restart. Unfortunately, there is a delay: after the update, each process will still serve one more request before reloading itself (e.g. if you're using 3 processes, the next 3 requests after the update will not be affected. The update will take effect on the requests made after the initial 3). This reloading mechanism works only on operating systems that have theexec(2)
system call, like Linux and other POSIX compliant systems. All examples above have an exception toconfigure
script. This script needs to run as a plain CGI script. There are some legacy extensions (not updated to Foswiki:Development/FoswikiStandAlone design) that adds scripts to thebin/
directory. You need to add exceptions for these scripts as well. FastCGI support on IIS 6.0 (and maybe other versions) is broken with respect to theSTDERR
stream. This may cause problems.
Author(s) | Gilmar Santos Jr | |||||||||||||||||||||
Copyright | © 2008 Gilmar Santos Jr and Foswiki Contributors | |||||||||||||||||||||
License: | GPL (Gnu General Public License) | |||||||||||||||||||||
Release: | 0.9.5 | |||||||||||||||||||||
Version: | 12487 (2011-09-08) | |||||||||||||||||||||
Change History: | ||||||||||||||||||||||
08 Sep 2011 | (0.9.5) Foswikitask:Item9957 - remove uninitialised value log message | |||||||||||||||||||||
26 Oct 2010 | (0.9.4) Foswikitask:Item9902 - Adding more resources about how to get and install CPAN lib and mod_fcgid or mod_fastcgi. Also includes temporary fix from Foswikitask:Item1515: added maxRequests to ease memory leaks and fix for Foswikitask:Item9456: Taint error with foswiki.fcgi | |||||||||||||||||||||
17 Sep 2010 | (0.9.3) Foswikitask:Item9701 - Documentation update, suggest mod_fcgid preferred over mod_fastcgi |
|||||||||||||||||||||
03 Sep 2010 | Foswikitask:Item9456 - Taint error, Foswikitask:Item9390 - LocalSite.cfg error handling, Foswikitask:Item8765 - Perl coding issue, Foswikitask:Item1315 - Support information | |||||||||||||||||||||
21 Dec 2009 | Foswiki:Main.ItaloValcy: fix Foswikitask:Item8238 | |||||||||||||||||||||
24 Jan 2009 | Documentation enhancements and some fixes (Foswikitask:Item853) | |||||||||||||||||||||
25 Dec 2008 | Initial Release | |||||||||||||||||||||
Dependencies: |
|
|||||||||||||||||||||
Home page: | http://foswiki.org/Extensions/FastCGIEngineContrib | |||||||||||||||||||||
Support: | http://foswiki.org/Support/FastCGIEngineContrib |