|
Revision 1, 1.2 kB
(checked in by jan, 4 years ago)
|
|
first import of lighttpd 1.3.10
|
| Line | |
|---|
| 1 | #!/bin/bash |
|---|
| 2 | |
|---|
| 3 | ## ABSOLUTE path to the spawn-fcgi binary |
|---|
| 4 | SPAWNFCGI="/home/weigon/projects/spawn-fcgi/src/spawn-fcgi" |
|---|
| 5 | |
|---|
| 6 | ## ABSOLUTE path to the PHP binary |
|---|
| 7 | FCGIPROGRAM="/usr/local/bin/php" |
|---|
| 8 | |
|---|
| 9 | ## bind to tcp-port on localhost |
|---|
| 10 | FCGIPORT="1026" |
|---|
| 11 | |
|---|
| 12 | ## number of PHP childs to spawn |
|---|
| 13 | PHP_FCGI_CHILDREN=10 |
|---|
| 14 | |
|---|
| 15 | ## number of request server by a single php-process until is will be restarted |
|---|
| 16 | PHP_FCGI_MAX_REQUESTS=1000 |
|---|
| 17 | |
|---|
| 18 | ## IP adresses where PHP should access server connections from |
|---|
| 19 | FCGI_WEB_SERVER_ADDRS="127.0.0.1,192.168.2.10" |
|---|
| 20 | |
|---|
| 21 | # allowed environment variables sperated by spaces |
|---|
| 22 | ALLOWED_ENV="ORACLE_HOME PATH USER" |
|---|
| 23 | |
|---|
| 24 | ## if this script is run as root switch to the following user |
|---|
| 25 | USERID=wwwrun |
|---|
| 26 | GROUPID=wwwrun |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | ################## no config below this line |
|---|
| 30 | |
|---|
| 31 | if test x$PHP_FCGI_CHILDREN = x; then |
|---|
| 32 | PHP_FCGI_CHILDREN=5 |
|---|
| 33 | fi |
|---|
| 34 | |
|---|
| 35 | export PHP_FCGI_MAX_REQUESTS |
|---|
| 36 | export FCGI_WEB_SERVER_ADDRS |
|---|
| 37 | |
|---|
| 38 | ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS FCGI_WEB_SERVER_ADDRS" |
|---|
| 39 | |
|---|
| 40 | if test x$UID = x0; then |
|---|
| 41 | EX="$SPAWNFCGI -p $FCGIPORT -f $FCGIPROGRAM -u $USERID -g $GROUPID -C $PHP_FCGI_CHILDREN" |
|---|
| 42 | else |
|---|
| 43 | EX="$SPAWNFCGI -p $FCGIPORT -f $FCGIPROGRAM -C $PHP_FCGI_CHILDREN" |
|---|
| 44 | fi |
|---|
| 45 | |
|---|
| 46 | # copy the allowed environment variables |
|---|
| 47 | E= |
|---|
| 48 | |
|---|
| 49 | for i in $ALLOWED_ENV; do |
|---|
| 50 | E="$E $i=${!i}" |
|---|
| 51 | done |
|---|
| 52 | |
|---|
| 53 | # clean environment and set up a new one |
|---|
| 54 | env - $E $EX |
|---|