# $OpenBSD: httpd.conf,v 1.9 2014/08/05 18:01:10 reyk Exp $

#
# Macros
#
ext_addr="egress"

#
# Global Options
#
# prefork 3

#
# Servers
#

# A minimal default server
server "default" {
	listen on $ext_addr port 80
}

# A name-based "virtual" server on the same address
server "www.example.com" {
	listen on $ext_addr port 80

	# Logging is enabled by default, but it can be turned off per server
	#no log

	location "/pub/*" {
		directory auto index
		log style combined
	}

	location "*.php" {
		fastcgi socket "/run/php-fpm.sock"
	}

	location "/cgi-bin/*" {
		fastcgi

		# The /cgi-bin directory is outside of the document root
		root "/"
	}

	root "/htdocs/www.example.com"
}

# An HTTPS server using SSL/TLS
server "secure.example.com" {
	listen on 127.0.0.1 port 443 ssl

	# Define server-specific log files relative to /logs
	log { access "secure-access.log", error "secure-error.log" }

	# Increase connection limits to extend the lifetime
	connection { max requests 500, timeout 3600 }

	root "/htdocs/secure.example.com"
}

# Another server on a different internal IPv4 address
server "intranet.example.com" {
	listen on 10.0.0.1 port 80
	directory { auto index, index "default.htm" }
	root "/htdocs/internet.example.com"
}

# An IPv6-based server on a non-standard port
server "ipv6.example.com" {
	listen on 2001:db8::53f6:3eab port 81
	root "/htdocs/ipv6.example.com"
}
