Browse Source

Add some ./run script examples for use with daemontools or runit

git-svn-id: svn://svn.lighttpd.net/spawn-fcgi/trunk@50 4a9f3682-ca7b-49a8-9a55-ba4640e46f83
master
Stefan Bühler 12 years ago
parent
commit
2b87a67326
  1. 1
      NEWS
  2. 49
      doc/run-generic
  3. 8
      doc/run-php
  4. 8
      doc/run-rails

1
NEWS

@ -5,6 +5,7 @@ NEWS
- 1.6.3 -
* Fix unix socket mode change to work without specifying user/group for socket
* Add some ./run script examples for use with daemontools or runit
- 1.6.2 - 2009-04-18
* Add homepage to README

49
doc/run-generic

@ -0,0 +1,49 @@
#!/bin/bash
# Use this as a run script with daemontools or runit
## ABSOLUTE path to the spawn-fcgi binary
SPAWNFCGI="/usr/bin/spawn-fcgi"
## ABSOLUTE path to the FastCGI application (php-cgi, dispatch.fcgi, ...)
FCGIPROGRAM="/usr/bin/php5-cgi"
## bind to unix socket
FCGISOCKET="/var/run/lighttpd/your-fcgi-app.sock"
# allowed environment variables separated by spaces
ALLOWED_ENV="PATH USER"
## if this script is run as root switch to the following user
USERID=xxx
SOCKUSERID=www-data
#CHROOT=/home/www/
#RAILS_ENV="production"
#export RAILS_ENV
################## no config below this line
exec 2>&1
if test x$PHP_FCGI_CHILDREN = x; then
PHP_FCGI_CHILDREN=4
fi
ALLOWED_ENV="$ALLOWED_ENV RAILS_ENV"
if test x$UID = x0; then
EX="$SPAWNFCGI -n -s $FCGISOCKET -u $USERID -U $SOCKUSERID -C $PHP_FCGI_CHILDREN -- $FCGIPROGRAM"
else
EX="$SPAWNFCGI -n -s $FCGISOCKET -C $PHP_FCGI_CHILDREN -- $FCGIPROGRAM"
fi
# copy the allowed environment variables
E=
for i in $ALLOWED_ENV; do
E="$E $i=${!i}"
done
# clean environment and set up a new one
exec env - $E $EX

8
doc/run-php

@ -0,0 +1,8 @@
#!/bin/sh
# Use this as a ./run script with daemontools or runit
# You should replace xxx with the user you want php to run as (and www-data with the user lighty runs as)
exec 2>&1
PHP_FCGI_CHILDREN=2 \
PHP_FCGI_MAX_REQUESTS=1000 \
exec /usr/bin/spawn-fcgi -n -s /var/run/lighttpd/php-xxx.sock -n -u xxx -U www-data -- /usr/bin/php5-cgi

8
doc/run-rails

@ -0,0 +1,8 @@
#!/bin/sh
# Use this as a ./run script with daemontools or runit
# You should replace xxx with the user you want rails to run as (and www-data with the user lighty runs as)
# /path-to-rails should be replaced with the correct path too :)
exec 2>&1
RAILS_ENV="production" \
exec /usr/bin/spawn-fcgi -n -s /var/run/lighttpd/rails-xxx.sock -u xxx -U www-data -- /path-to-rails/public/dispatch.fcgi
Loading…
Cancel
Save