Browse Source
git-svn-id: svn://svn.lighttpd.net/spawn-fcgi/trunk@50 4a9f3682-ca7b-49a8-9a55-ba4640e46f83master
4 changed files with 66 additions and 0 deletions
@ -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 |
@ -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 |
@ -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…
Reference in new issue