diff options
author | Adis Nezirovic <adis _at_ linux.org.ba> | 2010-05-11 15:01:31 +0200 |
---|---|---|
committer | Michiel van Wessem <michiel@slackbuilds.org> | 2010-05-11 15:01:31 +0200 |
commit | 4c82c26e60d40fdb758b9b64b94f6c29007a1555 (patch) | |
tree | 78165f088cbed0f54d128efb0e1cae3092376a2a | |
parent | 2cc630e38f72150f8427e6b8f2a0080749039ebb (diff) |
network/mod_fcgid: Initial import
-rw-r--r-- | network/mod_fcgid/README | 53 | ||||
-rw-r--r-- | network/mod_fcgid/doinst.sh | 15 | ||||
-rw-r--r-- | network/mod_fcgid/httpd-fcgid.conf | 114 | ||||
-rw-r--r-- | network/mod_fcgid/mod_fcgid.SlackBuild | 63 | ||||
-rw-r--r-- | network/mod_fcgid/mod_fcgid.info | 8 | ||||
-rw-r--r-- | network/mod_fcgid/slack-desc | 11 |
6 files changed, 264 insertions, 0 deletions
diff --git a/network/mod_fcgid/README b/network/mod_fcgid/README new file mode 100644 index 0000000000000..fb10cb9040a4e --- /dev/null +++ b/network/mod_fcgid/README @@ -0,0 +1,53 @@ +mod_fcgid is alternative FastCGI module for apache 2.x +(note that "old and proven" mod_fastcgi doesn't work at all with apache 2.2) + +With mod_fcgid apache controls spawned FastCGI processes (as oposed to "external" +FastCGI servers). + +Some features: + - Binary compatibility to mod_fastcgi + - Strict control on process spawn + - Simple spawning-speed control strategy + - Fastcgi server error detection + +Before running this script, you must have apache2 installed. +Download and build apache2 build script from http://slackbuilds.org + +To use it, add the following line to your httpd.conf file: + Include /etc/apache2/extra/httpd-fcgid.conf + +Sample SuEXEC php wrapper script: + #!/bin/sh + # + # sample PHP FastCGI wrapper + PHPRC="/etc" # directory which contains php.ini + PHP_FCGI_CHILDREN=4 + PHP_FCGI_MAX_REQUESTS=250 + export PHPRC PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS + exec /usr/bin/php-cgi + +and apropriate vhost config: + + # VirtualHost with SuExec and FastCGI PHP + <VirtualHost *:80> + # note: apache user should be member of 'vhost_group' + SuexecUserGroup vhost_user vhost_group + + ServerAdmin webmaster@vhost.example.com + DocumentRoot /var/www/vhosts/vhost.example.com/htdocs + ServerName vhost.example.com + ServerAlias www.vhost.example.com + ErrorLog /var/log/apache2/vhost.example.com-error_log + CustomLog /var/log/apache2/vhost.example.com-access_log common + + # note: chmod /var/www/vhosts/vhost.example.com to 0750 + <Directory /var/www/vhosts/vhost.example.com/htdocs> + Options ExecCGI + FCGIWrapper /var/www/vhosts/vhost.example.com/cgi-bin/php-wrapper .php + DirectoryIndex index.html index.php + + AllowOverride None + Order allow,deny + Allow from all + </Directory> + </VirtualHost> diff --git a/network/mod_fcgid/doinst.sh b/network/mod_fcgid/doinst.sh new file mode 100644 index 0000000000000..7f288c2c10afc --- /dev/null +++ b/network/mod_fcgid/doinst.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +copy_config() { + NEW="$1" + OLD="`dirname $NEW`/`basename $NEW .new`" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +copy_config etc/apache2/extra/httpd-fcgid.conf.new diff --git a/network/mod_fcgid/httpd-fcgid.conf b/network/mod_fcgid/httpd-fcgid.conf new file mode 100644 index 0000000000000..bf162304e1ec4 --- /dev/null +++ b/network/mod_fcgid/httpd-fcgid.conf @@ -0,0 +1,114 @@ +# Module and stuff +LoadModule fcgid_module libexec/apache2/mod_fcgid.so + +<IfModule mod_fcgid.c> + +# IdleTimeout n (300 seconds) +# An idle fastcgi application will be terminated after IdleTimeout seconds. +IdleTimeout 600 + +# IdleScanInterval n (120 seconds) +# The scan interval for idle fastcgi applications. +IdleScanInterval 240 + +# BusyTimeout n (300 seconds) +# A fastcgi application will be terminated if handing a single request +# longer than busy timeout. +BusyTimeout 300 + +# BusyScanInterval n (120 seconds) +# The scan interval for busy timeout fastcgi applications. +BusyScanInterval 120 + +# ErrorScanInterval n (3 seconds) +# The scan interval for exit pending fastcgi applications. fastcgi +# applications will be terminated within this scanning. +ErrorScanInterval 6 + +# ZombieScanInterval n (3 seconds) +# The scan interval for zombie process. +ZombieScanInterval 6 + +# ProcessLifeTime n (3600 seconds) +# A fastcgi application will be terminated if lifetime expired, +# even no error is detected. +ProcessLifeTime 3600 + +# SocketPath path (logs/fcgidsock) +# The directory to put the UNIX domain socket. (UNIX only) +# This directory should be writable only by apache user +SocketPath /var/run/apache2/fcgid/fcgidsock + +#SharememPath path (logs/fcgid_shm) +#The share memory file path. (UNIX only) (version >= 2.1 only) +SharememPath /var/run/apache2/fcgid/fcgid_shm + +# SpawnScoreUpLimit n (10) +# The spawn-speed control score up water limit. Score increases while +# a process is spawned or terminated, and decreases as time progresses; +# while the score is higher than SpawnScoreUpLimit, the spawning will be +# held for a while. The higher this number is, the higher speed of the +# spawning can be. +SpawnScoreUpLimit 10 + +# SpawnScore n (1) +# The weight of spawning. This weight will be plused to the spawn-control +# score on every spawn. The higher this number is, the lower speed of +# spawning can be. +SpawnScore 1 + +# TerminationScore n (2) +# The weight of termination. This weight will be plused to the score while +# fastcgi process terminates. The higher this number is, the lower speed +# of spawning can be. +TerminationScore 2 + +# MaxProcessCount n (1000) +# The max count of total fastcgi process count. +MaxProcessCount 256 + +# DefaultMaxClassProcessCount n (100) +# The maximum number of fastcgi application instances allowed to run for +# particular one fastcgi application. +DefaultMaxClassProcessCount 64 + +# DefaultMinClassProcessCount n (3) +# The minimum number of fastcgi application instances for any one fastcgi +# application. +# Idle fastcgi will not be killed if their count is less than n +# Set this to 0, and tweak IdleTimeout +DefaultMinClassProcessCount 0 + +# DefaultInitEnv env_name env_value +# The default environment variables before a fastcgi application +# is spawned. You can set this configuration more than once. + + +# IPCConnectTimeout n (3 seconds) +# The connect timeout to a fastcgi application. +IPCConnectTimeout 6 + +# IPCCommTimeout n (20 seconds) +# The communication timeout to a fastcgi application. Please increase this +# value if your CGI have a slow initialization or slow respond. +IPCCommTimeout 40 + +# OutputBufferSize n (64k bytes) +# CGI output cache buffer size. + +# PHP_Fix_Pathinfo_Enable n(n=0/1, default 0) +# If you are using PHP and set cgi.fix_pathinfo=1 in php.ini, set PHP_Fix_Pathinfo_Enable 1. +# From php.ini: +# cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's +# previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok +# what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting +# this to 1 will cause PHP CGI to fix it's paths to conform to the spec. A setting +# of zero causes PHP to behave as before. Default is zero. You should fix your scripts +# to use SCRIPT_FILENAME rather than PATH_TRANSLATED. +# cgi.fix_pathinfo=1 +#PHP_Fix_Pathinfo_Enable 1 + +AddHandler fcgid-script .php +AddHandler fcgid-script .fcgi + +</IfModule> diff --git a/network/mod_fcgid/mod_fcgid.SlackBuild b/network/mod_fcgid/mod_fcgid.SlackBuild new file mode 100644 index 0000000000000..68dd9da2dcfb6 --- /dev/null +++ b/network/mod_fcgid/mod_fcgid.SlackBuild @@ -0,0 +1,63 @@ +#!/bin/bash + +# Slackware build for mod_fcgid (to be used with Apache 2.2) +# Version: 2.1.0 Date: 2007-02-27 +# Copyright (c) 2007 Adis Nezirovic.<adis _at_ linux.org.ba> +# Licensed under GNU GPL v2 + +# Slightly modified by the slackbuild project +set -e + + +PRGNAM=mod_fcgid +VERSION=2.1 +# CFLAGS are hardcoded in /usr/lib/apr-1.2.x/build-1/apr_rules.mk +# and ARCH should reflect that, so don't change it ;-) +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +# Other important variables +APACHE2_PREFIX=usr +APACHE2_LIBEXEC=usr/libexec/apache2 +APACHE2_ETC=etc/apache2 +APACHE2_VAR_RUN=var/run/apache2 + +rm -rf $TMP/$PRGNAM.$VERSION $PKG +mkdir -p $TMP $PKG $OUTPUT +mkdir -p $PKG/{$APACHE2_LIBEXEC,$APACHE2_ETC/extra,$APACHE2_ETC/original/extra,$APACHE2_VAR_RUN} + +cd $TMP +tar xzvf $CWD/$PRGNAM.$VERSION.tar.gz +cd $TMP/$PRGNAM.$VERSION +chmod -R a-s,u+w,go+r-w . +chown -R root:root . + +make top_dir=/$APACHE2_PREFIX top_builddir=/$APACHE2_LIBEXEC top_srcdir=/$APACHE2_LIBEXEC || exit 1 +# make install spams the root partition, this is cleaner :-) +/$APACHE2_LIBEXEC/build/instdso.sh SH_LIBTOOL=libtool $PRGNAM.la $PKG/$APACHE2_LIBEXEC || exit 1 + +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +) + +## mod_fcgid writes socket to this directory +mkdir -p $PKG/$APACHE2_VAR_RUN/fcgid/fcgidsock +chown -R apache2:apache2 $PKG/$APACHE2_VAR_RUN/fcgid +chmod -R 700 $PKG/$APACHE2_VAR_RUN/fcgid + +## mod_fcgid config +cat $CWD/httpd-fcgid.conf > $PKG/$APACHE2_ETC/extra/httpd-fcgid.conf.new +cat $CWD/httpd-fcgid.conf > $PKG/$APACHE2_ETC/original/extra/httpd-fcgid.conf + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz diff --git a/network/mod_fcgid/mod_fcgid.info b/network/mod_fcgid/mod_fcgid.info new file mode 100644 index 0000000000000..1dad4c50c9d22 --- /dev/null +++ b/network/mod_fcgid/mod_fcgid.info @@ -0,0 +1,8 @@ +PRGNAM="mod_fcgid" +VERSION="2.1" +HOMEPAGE="http://fastcgi.coremail.cn" +DOWNLOAD="http://dl.sourceforge.net/mod-fcgid/mod_fcgid.2.1.tar.gz" +MD5SUM="0bc036276e378463c80617ff57e853dc" +MAINTAINER="Adis Nezirovic" +EMAIL="adis _at_ linux.org.ba" +APPROVED="BP{k}" diff --git a/network/mod_fcgid/slack-desc b/network/mod_fcgid/slack-desc new file mode 100644 index 0000000000000..f8e8ae4203bef --- /dev/null +++ b/network/mod_fcgid/slack-desc @@ -0,0 +1,11 @@ +mod_fcgid: mod_fcgid +mod_fcgid: +mod_fcgid: mod_fcgid is alternative FastCGI module for apache 2.x +mod_fcgid: "old and proven" mod_fastcgi doesn't work at all with apache 2.2 +mod_fcgid: It is binary compatibility to mod_fastcgi, and has interesting +mod_fcgid: process spawning strategy. +mod_fcgid: +mod_fcgid: Home page: http://fastcgi.coremail.cn for more info. +mod_fcgid: +mod_fcgid: +mod_fcgid: |