Created
August 11, 2010 19:40
-
-
Save kamawanu/519592 to your computer and use it in GitHub Desktop.
lighttpd with suexec without apache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$HTTP["url"] =~ "^/~.+/" { | |
cgi.assign = ( | |
# ".pl" => "/usr/bin/perl", | |
# ".php" => "/usr/bin/php5-cgi", # FASTCGI | |
".py" => "/usr/bin/python", | |
".cgi" => "/usr/sbin/lighttpd-suexec" | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -x | |
VERSION=${1-2.2.19} | |
wget -N http://ftp.kddilabs.jp/infosystems/apache/httpd/httpd-$VERSION.tar.gz | |
tar xfz httpd-$VERSION.tar.gz | |
##exit | |
cd httpd-$VERSION || exit 9 | |
# http://d.hatena.ne.jp/ikasam_a/20060817/1155826140 | |
./configure \ | |
--enable-suexec \ | |
--with-suexec \ | |
--with-suexec-caller=www-data \ | |
--with-suexec-docroot=/home \ | |
--with-suexec-logfile=/tmp/suexec.log \ | |
--with-suexec-bin=/usr/sbin/suexec \ | |
--with-suexec-uidmin=500 \ | |
--with-suexec-gidmin=500 | |
cd support | |
make suexec | |
install -m 07511 -o 1 -g 1 suexec /usr/sbin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -x | |
if [ ! -f /usr/sbin/lighttpd-suexec ] | |
then | |
install -m 0555 -o 1 -g 1 lighttpd-suexec.sh /usr/sbin/lighttpd-suexec | |
fi | |
if [ ! -f /usr/local/apache2/bin/suexec ] | |
then | |
cat build-suexecwrapper-for-lighttpd.sh | sudo /bin/sh | |
fi | |
CONFCGI=/etc/lighttpd/conf-enabled/10-cgi.conf | |
if [ ! -h $CONFCGI ] | |
then | |
ln -s ../conf-available/10-cgi.conf $CONFCGI | |
fi | |
sudo tee -a $CONFCGI < 10-cgi.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# http://d.hatena.ne.jp/ikasam_a/20060817/1155826140 | |
SUEXEC=/usr/local/apache2/bin/suexec | |
DIR=`dirname $1` | |
SCRIPT=`basename $1` | |
USER=`stat -c '%U' $1` | |
GROUP=`stat -c '%G' $1` | |
cd $DIR || exit 9 | |
exec $SUEXEC $USER $GROUP $SCRIPT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -x | |
if [ ! -f /usr/sbin/lighttpd-suexec ] | |
then | |
curl https://gist.github.com/raw/519592/4a5f2b5be258c2334d26a2faa023f55f48df8584/lighttpd-suexec.sh | sudo tee /usr/sbin/lighttpd-suexec | |
chmod 0755 /usr/sbin/lighttpd-suexec | |
fi | |
if [ ! -f /usr/local/apache2/bin/suexec ] | |
then | |
curl https://gist.github.com/raw/519592/f688b400feda6a32eab5fce0daf373828b16bff7/build-suexecwrapper-for-lighttpd.sh | sudo /bin/sh | |
fi | |
( | |
cd /etc/lighttpd/conf-enabled || exit 9 | |
if [ ! -h 10-cgi.conf ] | |
then | |
ln -sf ../conf-available/10-cgi.conf | |
fi | |
curl https://gist.github.com/raw/519592/ce0883e01ef8328627c98e80695c6f8113801bde/10-cgi.conf | sudo tee -a 10-cgi.conf | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get install gcc++ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment