# 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", "mod_dirlist", "mod_deflate", "mod_redirect", "mod_rewrite", "mod_vhost", "mod_lua" );
#		mod_access,
#		mod_accesslog,
#		mod_auth,
#		mod_balance,
#		mod_cache_disk_etag,
#		mod_debug,
#		mod_deflate,
#		mod_dirlist,
#		mod_expire,
#		mod_fastcgi,
#		mod_flv,
#		mod_fortune,
#		mod_limit,
#		mod_lua,
#		mod_memcached,
#		mod_openssl,
#		mod_progress,
#		mod_proxy,
#		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";

	log ["debug" => "", "*" => "/var/log/lighttpd2/error.log"];
	accesslog "/var/log/lighttpd2/access.log";
	accesslog.format "%h %V %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"";

	static.exclude_extensions ( ".php", ".pl", ".fcgi", "~", ".inc" );
}

# 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 = {
	phpfpm { fastcgi "unix:/var/run/lighttpd2/php-fpm.sock"; };
};

if req.path == "/status" { status.info; }

include "/etc/lighttpd2/mimetypes.conf";

docroot "/var/www/htdocs-lighttpd";

# 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" );

# 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;

# 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;
