#
# lighttpd configuration file for captiveportal API access (used by proxy pass on every zone, only accessible via localhost)
#
############ Options you really have to take care of ####################

## modules to load
server.modules              = ( "mod_access", "mod_expire", "mod_deflate", "mod_redirect",
				"mod_cgi", "mod_fastcgi","mod_alias", "mod_rewrite"
)

server.max-keep-alive-requests = 15
server.max-keep-alive-idle = 30

## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root        = "/usr/local/opnsense/www/"


# Phalcon api routing
alias.url += ( "/api/"  => "/usr/local/opnsense/www/" )
url.rewrite = ( "^/api/(.*)$" => "/api/api.php?_url=/$1")


# Maximum idle time with nothing being written (php downloading)
server.max-write-idle = 999

## where to send error-messages to
server.errorlog-use-syslog="enable"

# files to check for if .../ is requested
server.indexfiles           = ( "index.php", "index.html",
                                "index.htm", "default.htm" )

url.access-deny             = ( "~", ".inc" )


######### Options that are good to be but not necessary to be changed #######

## bind to port (default: 80)
server.bind  = "127.0.0.1"
server.port  = 8999

## to help the rc.scripts
server.pid-file            = "/var/run/lighttpd-api-dispatcher.pid"

## enable debugging
debug.log-request-header   = "disable"
debug.log-response-header  = "disable"
debug.log-request-handling = "disable"
debug.log-file-not-found   = "disable"
server.max-request-size    = 2097152

#### fastcgi module
## read fastcgi.txt for more info
fastcgi.server = ( ".php" =>
	( "localhost" =>
		(
			"socket" => "/tmp/php-fastcgi.socket",
			"max-procs" => 2,
			"bin-environment" => (
				"PHP_FCGI_CHILDREN" => "1",
				"PHP_FCGI_MAX_REQUESTS" => "500"
			),
			"bin-path" => "/usr/local/bin/php-cgi"
		)
	)
)
