Skip to content

Instantly share code, notes, and snippets.

@kamawanu
Created August 11, 2010 19:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamawanu/519592 to your computer and use it in GitHub Desktop.
Save kamawanu/519592 to your computer and use it in GitHub Desktop.
lighttpd with suexec without apache
$HTTP["url"] =~ "^/~.+/" {
cgi.assign = (
# ".pl" => "/usr/bin/perl",
# ".php" => "/usr/bin/php5-cgi", # FASTCGI
".py" => "/usr/bin/python",
".cgi" => "/usr/sbin/lighttpd-suexec"
)
}
#!/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
#!/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
#!/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
#!/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
)
apt-get install gcc++
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment