#
# this is a sample configuration file for qsehttpd.
#

# string to be used as a httpd name 
name = "QSEHTTPD v1";

# none, unlimited, or positive number
max-nofile = none;
max-nproc = none;

#hooks {
#	module "ext-1" {
#		file = "ext";
#		config {
#			item1 = abc;
#			item2 = def;
#		}
#	}
#}

################################################
# default server configuration
################################################
server-default {
	# default ssl certificate file
	#ssl-cert-file = "/etc/qse/cert.pem";
	# default ssl private key file
	#ssl-key-file =  "/etc/qse/key.pem";

	####################################################################
	# document root
	####################################################################
	root = "/var/www";
	#root = "1.2.3.4:80";
	#root = "https://1.2.3.4";
	#root = "http://code.abiyo.net";
	#root = "<302>http://www.google.com"; #301, 302, 303, 307, 308
	#root = "<404>"; #400 - 599

	# pseudonym to use in Via: for proxying
	#pseudonym = "my-host";

	realm = "default realm";
	auth = "username:password";
	index = "index.html",
	        "index.cgi";

	# you can get some files exempted from authorization 
	# with auth-rule.
	#auth-rule {
	#	suffix ".awk" = noauth;
	#	other = auth;
	#}

	cgi {

		#name "t3.nph" = "nph";
		#prefix "t3." = "nph";
		suffix ".cgi";
		suffix ".nph" = "nph";
		suffix ".awk" = "cgi", "/usr/bin/qseawk -f";

		# glob is not supported yet
		# glob "x*.xxx";
	}

	mime {
		@include "httpd-mime.conf";
	}



	####################################################################
	#
	# Accee control including dir-access and file-access can be 
	# defined using patterns and actions shown below
	#
	# Pattern
	# 	prefix ".xxxx"     (prefix match)
	# 	suffix "xxxx."     (suffix match)
	# 	name   "xxxx.yyyy" (exact match)
	# 	other              (all others)
	#
	# Action
	#	noent
	#	forbid
	#	ok
	#
	####################################################################


	####################################################################
	# control access to directories
	####################################################################
	dir-access {
		#prefix ".xxxx" = ok;
		#suffix ".xxxx" = ok;
		#name "xxxxx" = ok;
		#other = noent;
	}

	####################################################################
	# control access to normal files.
	# cgi scripts are not control by these.
	####################################################################
	file-access {
		#prefix "index.html." = ok;
		suffix ".html" = ok;
		suffix ".css" = ok;
		suffix ".js" = ok;
		suffix ".png" = ok;
		suffix ".jpg" = ok;
		#other = noent;
	}

	####################################################################
	# directory listing includes this string in the <head> tag of the
	# generated html page.
	####################################################################
	#dir-head = "<style type='text/css'>body { background-color:#d0e4fe; font-size: 0.9em; } div.header { font-weight: bold; margin-bottom: 5px; } div.footer { border-top: 1px solid #99AABB; text-align: right; } table { font-size: 0.9em; } td { white-space: nowrap; } td.size { text-align: right; }</style>";

	####################################################################
	# directory listing shows the httpd name in the footer. you can 
	# override it with dir-foot.
	####################################################################
	#dir-foot = "QSEHTTPD v1";

	####################################################################
	# the error page includes this string in the <head> tag of the 
	# generated html page.
	####################################################################
	#error-head = "<style type='text/css'>body { background-color:#d0e4fe; font-size: 0.9em; } div.header { font-weight: bold; margin-bottom: 5px; } div.footer { border-top: 1px solid #99AABB; text-align: right; }</style>";

	####################################################################
	# the error page shows the httpd name in the footer. you can
	# override it with error-foot.
	####################################################################
	#error-foot = "QSEHTTPD v1";

	####################################################################
	# Default proxy configuration
	####################################################################
	proxy {
		http = yes;        # yes/on, no/off
		https = yes;        # yes/on, no/off
		connect = yes;     # yes/on, no/off
		intercept = yes;   # yes/proxy/on, local, no/off, 
		upgrade = yes;     # yes/on, no/off
		x-forwarded = yes; # yes/on, no/off

		#pseudonym = "nice-host";

		# TOOD: add-headers and remove-headers
		#add-headers = "X-Forwarded-For: ${Client_Ipaddr}", 
		#              "X-Forwarded-Proto: ${Client-Proto}";
		#remove-headers = "Connection";

		dns-enabled = yes; # yes/on, no/off
		dns-server = "192.168.1.1:53";
		#dns-server = "[::1]:53";
		#dns-server = "@/tmp/dns.sock"; # unix socket prefixed with @
		#dns-timeout = 3
		#dns-retries = 2
		dns-queries = a, aaaa;

		#urs-enabled = yes; # no, yes,
		#urs-server = "127.0.0.1:97";
		#urs-server = "@/tmp/urs.sock"; # unix socket prefixed with @
		#urs-timeout = 1;
		#urs-retries = 4;
		#urs-prerewrite-hook = "ext-1";
	}
}

server {
	bind = "0.0.0.0:1999";
	ssl = yes;

	# you can create certificate/key files as shown below
	#  openssl genrsa -out key.pem
	#  openssl req -new -key key.pem -out cert.csr
	#  openssl req -new -x509 -key key.pem -out cert.pem -days 1095
	ssl-cert-file = "/etc/qse/cert.pem";
	ssl-key-file =  "/etc/qse/key.pem";
	
	host "*" {
		# place other locations before /
		#location "/help"  {
		#}

		location "/" {
			# uncomment the followng block to override the default.
			#root = "/var/www";

			# pseudonym to use in Via: for proxying
			#pseudonym = "my-host";

			# uncomment the followng block to override the default.
			# if you want to disable authentication while the default
			# enables it, don't put a value like 'realm;'
			#realm = "default realm";
			#auth = "username:password";

			# uncomment the following block to override the default
			#index = "index.cgi", "index.html";

			# uncomment the following block to override the default
			#cgi {
			#	suffix ".cgi";
			#	suffix ".awk" = "/usr/bin/qseawk -f";
			#}

			# uncomment the following block to override the default.
			#mime {
			#	suffix ".htm" = "text/html";
			#	suffix ".html" = "text/html";
			#	suffix ".txt" = "text/html";
			#	suffix ".css" = "text/css";
			#	suffix ".xml" = "text/xml";
			#	suffix ".js" = "application/javascript";
			#	suffix ".jpg" = "image/jpeg";
			#	suffix ".png" = "image/png";
			#}
		}

	}

	#host "www.google.com" {
	#	location "/" {
	#		root = "/home/www/google";
	#		realm = "jjjjjjjj";
	#		auth = "username:password";
	#	}
	#}
}
