aboutsummaryrefslogtreecommitdiff
path: root/network/lighttpd2/conf
diff options
context:
space:
mode:
authorMatteo Bernardini <ponce@slackbuilds.org>2013-01-13 13:20:52 -0600
committerRobby Workman <rworkman@slackbuilds.org>2013-01-13 13:20:52 -0600
commit4d0483f0ceeaf031ea84a18e4c4ecbdc3a0c51af (patch)
tree15e6966dd1b6dad62fbd58e6a7f1e13ba02460af /network/lighttpd2/conf
parent030614f6b0430aa4b433019e9ddc973c482e806c (diff)
network/lighttpd2: Updated for version 20121206_01abf70.
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'network/lighttpd2/conf')
-rw-r--r--network/lighttpd2/conf/lighttpd.conf58
-rw-r--r--network/lighttpd2/conf/lighttpd2.logrotate28
-rw-r--r--network/lighttpd2/conf/php-fpm.lua10
-rw-r--r--network/lighttpd2/conf/rc.lighttpd28
-rw-r--r--network/lighttpd2/conf/rc.spawn-fcgi77
5 files changed, 81 insertions, 100 deletions
diff --git a/network/lighttpd2/conf/lighttpd.conf b/network/lighttpd2/conf/lighttpd.conf
index 20b47e840efd2..1a62342940373 100644
--- a/network/lighttpd2/conf/lighttpd.conf
+++ b/network/lighttpd2/conf/lighttpd.conf
@@ -1,7 +1,13 @@
+# Sample /etc/lighttpd2/lighttpd.conf file
+# Assembled and commented by Matteo Bernardini <ponce@slackbuilds.org>
+# Default modules here should cover most needs: if you want to cut
+# down some, consider that mod_access and mod_accesslog are mandatory.
+# http://redmine.lighttpd.net/projects/lighttpd2/wiki/Modules
setup {
- module_load ( "mod_fastcgi", "mod_status", "mod_access", "mod_accesslog" );
+ module_load ( "mod_fastcgi", "mod_status", "mod_access", "mod_accesslog", "mod_dirlist", "mod_deflate", "mod_redirect", "mod_rewrite", "mod_vhost", "mod_lua" );
# mod_access,
+# mod_accesslog,
# mod_auth,
# mod_balance,
# mod_cache_disk_etag,
@@ -9,6 +15,7 @@ setup {
# mod_deflate,
# mod_dirlist,
# mod_expire,
+# mod_fastcgi,
# mod_flv,
# mod_fortune,
# mod_limit,
@@ -20,9 +27,12 @@ setup {
# mod_redirect,
# mod_rewrite,
# mod_scgi,
+# mod_status,
# mod_userdir,
# mod_vhost,
+ lua.plugin "/etc/lighttpd2/php-fpm.lua";
+
listen "0.0.0.0:80";
listen "[::]:80";
@@ -33,13 +43,12 @@ setup {
static.exclude_extensions ( ".php", ".pl", ".fcgi", "~", ".inc" );
}
-# named action block
+# http://redmine.lighttpd.net/projects/lighttpd2/wiki/Conditions
+
+# Run php through php-fpm: be sure to read README.SLACKWARE
+# http://redmine.lighttpd.net/projects/lighttpd2/wiki/Howto_PHP
php = {
- if phys.path =$ ".php" {
- if physical.is_file {
- fastcgi "unix:/var/run/lighttpd2/www-default-php.sock";
- }
- }
+ phpfpm { fastcgi "unix:/var/run/lighttpd2/php-fpm.sock"; };
};
if req.path == "/status" { status.info; }
@@ -48,10 +57,39 @@ include "/etc/lighttpd2/mimetypes.conf";
docroot "/var/www/htdocs-lighttpd";
-index ( "index.php", "index.html", "default.html" );
+# If you install phpmyadmin from the SBo script, it should go there.
+# Uncomment below, after having installed.
+#alias ( "/phpmyadmin" => "/var/www/htdocs/phpmyadmin" );
+
+# Directory listings are enabled by default only for an eventual
+# "pub" folder in the docroot: change as needed.
+# http://redmine.lighttpd.net/projects/lighttpd2/wiki/Mod_dirlist
+if req.path =~ "^/pub/" {
+ dirlist;
+}
+
+# Directory index files: this commented below can be useful if you
+# enable php.
+#index ( "index.php", "index.html" );
+index ( "index.html" );
-# alias "/phpmyadmin" => "/var/www/htdocs/phpmyadmin";
+# If you want to use urls like http://example.com/index.php/some/path
+# (using your php files like directories), you need this (ex. wordpress)
+#pathinfo;
-php;
+# Some useful rules to avoid access to sensitive files from remote.
+# This example still applies to wordpress
+#if req.remoteip != "127.0.0.1" {
+# if req.path =~ "^/wp-includes/" { access.deny; }
+#}
+# Deny access to some file-extensions
+# ~ is for backupfiles from vi, emacs, joe, ...
+# .inc is often used for code includes which should in general not be
+# part of the document-root
+if phys.path =$ "~" or phys.path =$ ".inc" {
+ if phys.is_file { access.deny; }
+}
+# Uncomment this to enable php
+#php;
diff --git a/network/lighttpd2/conf/lighttpd2.logrotate b/network/lighttpd2/conf/lighttpd2.logrotate
index 19a2f5abeb7a2..04d448ac6b9b2 100644
--- a/network/lighttpd2/conf/lighttpd2.logrotate
+++ b/network/lighttpd2/conf/lighttpd2.logrotate
@@ -1,16 +1,32 @@
-/var/log/lighttpd2/*.log {
+/var/log/lighttpd2/access.log /var/log/lighttpd2/error.log {
daily
missingok
copytruncate
- rotate 7
- create 0644 lighttpd lighttpd
+ rotate 30
+ create 0644 lighttpd root
compress
notifempty
- su lighttpd lighttpd
+ su lighttpd root
sharedscripts
postrotate
- if [ -x /etc/rc.d/rc.lighttpd2 -a -f /var/run/lighttpd.pid ]; then
- /etc/rc.d/rc.lighttpd2 reload
+ if [ -x /etc/rc.d/rc.lighttpd2 -a -f /var/run/lighttpd2/lighttpd2.pid ]; then
+ /etc/rc.d/rc.lighttpd2 restart
+ fi
+ endscript
+}
+
+/var/log/lighttpd2/lighttpd2.log {
+ daily
+ missingok
+ copytruncate
+ rotate 30
+ create 0644 root root
+ compress
+ notifempty
+ sharedscripts
+ postrotate
+ if [ -x /etc/rc.d/rc.lighttpd2 -a -f /var/run/lighttpd2/lighttpd2.pid ]; then
+ /etc/rc.d/rc.lighttpd2 restart
fi
endscript
}
diff --git a/network/lighttpd2/conf/php-fpm.lua b/network/lighttpd2/conf/php-fpm.lua
new file mode 100644
index 0000000000000..f26bb9d796664
--- /dev/null
+++ b/network/lighttpd2/conf/php-fpm.lua
@@ -0,0 +1,10 @@
+local function phpfpm(act)
+ return action.when(physical.path:suffix(".php"),
+ action.when(physical.is_file:is(), act),
+ action.when(request.path:eq("/fpm-status"), act)
+ )
+end
+
+actions = {
+ ["phpfpm"] = phpfpm,
+}
diff --git a/network/lighttpd2/conf/rc.lighttpd2 b/network/lighttpd2/conf/rc.lighttpd2
index 31ade849fe923..e7a8ca286affb 100644
--- a/network/lighttpd2/conf/rc.lighttpd2
+++ b/network/lighttpd2/conf/rc.lighttpd2
@@ -19,6 +19,7 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+# Adapted for lighttpd2 by Matteo Bernardini <ponce@slackbuilds.org>
LIGHTTPD=/usr/sbin/lighttpd2
LIGHTTPD_OPTIONS="-c /etc/lighttpd2/angel.conf"
@@ -53,10 +54,6 @@ lighttpd_restart() {
lighttpd_start
}
-lighttpd_reload() {
- kill -s HUP $PIDOF_WORKER
-}
-
case "$1" in
'start')
lighttpd_start
@@ -67,9 +64,6 @@ case "$1" in
restart)
lighttpd_restart
;;
-reload)
- lighttpd_reload
- ;;
*)
echo "usage $0 start|stop|restart"
esac
diff --git a/network/lighttpd2/conf/rc.spawn-fcgi b/network/lighttpd2/conf/rc.spawn-fcgi
deleted file mode 100644
index 146dc4f3bb807..0000000000000
--- a/network/lighttpd2/conf/rc.spawn-fcgi
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2012, ponce <matteo.bernardini@gmail.com>
-# All rights reserved.
-#
-# Redistribution and use of this script, with or without modification, is
-# permitted provided that the following conditions are met:
-#
-# 1. Redistributions of this script must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-SPAWNFCGI=/usr/bin/spawn-fcgi
-FCGI_PROGRAM=/usr/bin/php-cgi
-FCGI_SOCKET=/var/run/lighttpd2/www-default-php.sock
-PHP_FCGI_CHILDREN=4
-FCGI_CHILDREN=1
-CGI_USER=lighttpd
-CGI_GROUP=lighttpd
-SOCKET_USER=lighttpd
-SOCKET_GROUP=lighttpd
-PIDFILE=/var/run/lighttpd2/spawn-fcgi.pid
-PHP_FCGI_MAX_REQUESTS=1000
-
-export PHP_FCGI_MAX_REQUESTS
-
-spawnfcgi_start() {
- echo "Starting spawn-fcgi: $SPAWNFCGI"
- if [ -f "$PIDFILE" ]; then
- echo "Already running!"
- return
- fi
- $SPAWNFCGI -s $FCGI_SOCKET -u $CGI_USER -U $SOCKET_USER \
- -g $CGI_USER -G $SOCKET_GROUP -P $PIDFILE \
- -C $PHP_FCGI_CHILDREN -F $FCGI_CHILDREN -- $FCGI_PROGRAM \
- >> /dev/null 2>&1
-}
-
-spawnfcgi_stop() {
- echo "Stopping spawn-fcgi: $SPAWNFCGI"
- if [ -f "$PIDFILE" ]; then
- rm -f $PIDFILE $FCGI_SOCKET
- killall $FCGI_PROGRAM
- else
- echo "Not running!"
- fi
-}
-
-spawnfcgi_restart() {
- spawnfcgi_stop
- sleep 1
- spawnfcgi_start
-}
-
-case "$1" in
-'start')
- spawnfcgi_start
- ;;
-'stop')
- spawnfcgi_stop
- ;;
-restart)
- spawnfcgi_restart
- ;;
-*)
- echo "usage $0 start|stop|restart"
-esac