From e324583170f1bbf4443f8675263b01a4388b6c4a Mon Sep 17 00:00:00 2001 From: kakwa Date: Mon, 20 Jul 2015 01:43:44 +0200 Subject: [PATCH] adding goodies --- goodies/apache.conf | 8 ++++ goodies/init-debian | 93 +++++++++++++++++++++++++++++++++++++++++++ goodies/lighttpd.conf | 7 ++++ goodies/nginx.conf | 14 +++++++ 4 files changed, 122 insertions(+) create mode 100644 goodies/apache.conf create mode 100755 goodies/init-debian create mode 100644 goodies/lighttpd.conf create mode 100644 goodies/nginx.conf diff --git a/goodies/apache.conf b/goodies/apache.conf new file mode 100644 index 0000000..2c0a6b7 --- /dev/null +++ b/goodies/apache.conf @@ -0,0 +1,8 @@ + + + + ProxyPass http://127.0.0.1:8080/ + ProxyPassReverse http://127.0.0.1:8080/ + + + diff --git a/goodies/init-debian b/goodies/init-debian new file mode 100755 index 0000000..1d8f056 --- /dev/null +++ b/goodies/init-debian @@ -0,0 +1,93 @@ +#! /bin/sh + +### BEGIN INIT INFO +# Provides: ldapcherryd +# Required-Start: $remote_fs $network $syslog +# Required-Stop: $remote_fs $network $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: +# Short-Description: ldapcherry +### END INIT INFO + +PIDFILE=/var/run/ldapcherryd/ldapcherryd.pid +CONF=/etc/ldapcherry/ldapcherry.ini +USER=www-data +GROUP=www-data +BIN=/usr/local/bin/ldapcherryd +OPTS="-d -c $CONF -p $PIDFILE" + +. /lib/lsb/init-functions + +if [ -f /etc/default/ldapcherryd ]; then + . /etc/default/ldapcherryd +fi + +start_ldapcherryd(){ + log_daemon_msg "Starting ldapcherryd" "ldapcherryd" || true + pidofproc -p $PIDFILE $BIN >/dev/null + status="$?" + if [ $status -eq 0 ] + then + log_end_msg 1 + log_failure_msg \ + "ldapcherryd already started" + return 1 + fi + mkdir -p `dirname $PIDFILE` -m 750 + chown $USER:$GROUP `dirname $PIDFILE` + if start-stop-daemon -c $USER:$GROUP --start \ + --quiet --pidfile $PIDFILE \ + --oknodo --exec $BIN -- $OPTS + then + log_end_msg 0 || true + return 0 + else + log_end_msg 1 || true + return 1 + fi + +} + +stop_ldapcherryd(){ + log_daemon_msg "Stopping ldapcherryd" "ldapcherryd" || true + if start-stop-daemon --stop --quiet \ + --pidfile $PIDFILE + then + log_end_msg 0 || true + return 0 + else + log_end_msg 1 || true + return 1 + fi +} + +case "$1" in + start) + start_ldapcherryd + exit $? + ;; + stop) + stop_ldapcherryd + exit $? + ;; + restart) + stop_ldapcherryd + while pidofproc -p $PIDFILE $BIN >/dev/null + do + sleep 0.5 + done + start_ldapcherryd + exit $? + ;; + status) + status_of_proc -p $PIDFILE $BIN "ldapcherryd" \ + && exit 0 || exit $? + ;; + *) + log_action_msg \ + "Usage: /etc/init.d/ldapcherryd {start|stop|restart|status}" \ + || true + exit 1 +esac + +exit 0 diff --git a/goodies/lighttpd.conf b/goodies/lighttpd.conf new file mode 100644 index 0000000..e5173ad --- /dev/null +++ b/goodies/lighttpd.conf @@ -0,0 +1,7 @@ +server.modules += ("mod_proxy") + +$HTTP["host"] == "ldapcherry.kakwa.fr" { + proxy.server = ( "" => + (( "host" => "127.0.0.1", "port" => 8080 )) + ) +} diff --git a/goodies/nginx.conf b/goodies/nginx.conf new file mode 100644 index 0000000..9789f93 --- /dev/null +++ b/goodies/nginx.conf @@ -0,0 +1,14 @@ +server { + listen 80 default_server; + + server_name $hostname; + #access_log /var/log/nginx/dnscherry_access_log; + + location / { + proxy_pass http://127.0.0.1:8080; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for; + proxy_set_header Host $host:$server_port; + proxy_set_header X-Forwarded-Proto $remote_addr; + } +}