gviaud icon

Working OpenWRT haproxy.cfg for multiple domain resolution

gviaud | PRO | 06/01/17 02:54:14 PM UTC | 0 ⭐ | 971 👁️ | Never ⏰ | []
text |

2.17 KB

|

None

|

0 👍

/

0 👎

# Global parameters	
global	
	# Log events to a remote syslog server at given address using the	
	# specified facility and verbosity level. Multiple log options	
	# are allowed.	
	#log 10.0.0.1 daemon info	
 	# Specifiy the maximum number of allowed connections.	
	maxconn 32000	
 	# Raise the ulimit for the maximum allowed number of open socket	
	# descriptors per process. This is usually at least twice the	
	# number of allowed connections (maxconn * 2 + nb_servers + 1) .	
	ulimit-n 65535	
 	# Drop privileges (setuid, setgid), default is "root" on OpenWrt.	
	uid 0	
	gid 0	
 	# Daemonize on startup	
	daemon	
 	nosplice	
	# Enable debugging	
	#debug	
 	# Spawn given number of processes and distribute load among them,	
	# used for multi-core environments or to circumvent per-process	
	# limits like number of open file descriptors. Default is 1.	
	#nbproc 2	
 	# Reduce to user nobody after start	
	user nobody	
 listen http-in	
	bind :80	
	bind :443 ssl crt /etc/certs/mydomain.com.pem no-sslv3	
	mode http	
 	reqadd X-Forwarded-Proto:\ https	
 	# Define hosts	
	acl host_nextcloud hdr(host) -i nextcloud.mydomain.com	
	acl host_plex hdr(host) -i plex.mydomain.com	
	acl host_uhttpd hdr(host) -i 192.168.1.1	
 	## Figure out which backend (server) to use	
	use_backend nextcloud_cluster if host_nextcloud	
	use_backend plex_cluster if host_plex	
	use_backend uhttpd_cluster if host_uhttpd	
 listen http-in
	bind :80
	bind :443 ssl crt /etc/certs/mydomain.com.pem no-sslv3
	mode http
 	reqadd X-Forwarded-Proto:\ https
 	# Define hosts
	acl host_nextcloud hdr(host) -i nextcloud.mydomain.com
	acl host_plex hdr(host) -i plex.mydomain.com
	acl host_uhttpd hdr(host) -i 192.168.1.1
 	## Figure out which backend (server) to use
	use_backend nextcloud_cluster if host_nextcloud
	use_backend plex_cluster if host_plex
	use_backend uhttpd_cluster if host_uhttpd
 backend nextcloud_cluster
	mode http
	balance roundrobin
	server nextcloud 192.168.1.6:80
 backend plex_cluster
	mode http
	balance roundrobin
	server plex 192.168.1.3:32400
 backend uhttpd_cluster
	mode http
	balance roundrobin
	server uhttpd 192.168.1.1:65432

Comments