-
-
Save slmingol/8db8f7983598040f4e7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
log 127.0.0.1 local0 | |
log 127.0.0.1 local1 notice | |
#Adds a global syslog server. Up to two global servers can be defined. They | |
#will receive logs for startups and exits, as well as all logs from proxies | |
#configured with "log global". An optional level can be specified to filter | |
#outgoing messages. By default, all messages are sent. | |
#An IPv4 address optionally followed by a colon and a UDP port. If | |
#no port is specified, 514 is used by default (the standard syslog port). | |
maxconn 4096 | |
#Sets the maximum per-process number of concurrent connections to <number>. It | |
#is equivalent to the command-line argument "-n". Proxies will stop accepting | |
#connections when this limit is reached. The "ulimit-n" parameter is | |
#automatically adjusted according to this value. See also "ulimit-n" | |
uid 99 | |
#Changes the process' user ID to <number>. It is recommended that the user ID | |
#is dedicated to HAProxy or to a small set of similar daemons. HAProxy must | |
#be started with superuser privileges in order to be able to switch to another | |
#one. See also "gid" and "user". | |
gid 99 | |
#Changes the process' group ID to <number>. It is recommended that the group | |
#ID is dedicated to HAProxy or to a small set of similar daemons. HAProxy must | |
#be started with a user belonging to this group, or with superuser privileges. | |
#See also "group" and "uid". | |
daemon | |
#Makes the process fork into background. This is the recommended mode of | |
#operation. It is equivalent to the command line "-D" argument. It can be | |
#disabled by the command line "-db" argument. | |
#debug | |
#NO NEED TO ENABLE - krams | |
#Enables debug mode which dumps to stdout all exchanges, and disables forking | |
#into background. It is the equivalent of the command-line argument "-d". It | |
#should never be used in a production configuration since it may prevent full | |
#system startup. | |
#quiet | |
#NO NEED TO ENABLE - krams | |
#Do not display any message during startup. It is equivalent to the command- | |
#line argument "-q". | |
defaults | |
log global | |
#Enable per-instance logging of events and traffic. | |
#global should be used when the instance's logging parameters are the | |
#same as the global ones. This is the most common usage. "global" | |
#replaces <address>, <facility> and <level> with those of the log | |
#entries found in the "global" section. Only one "log global" | |
#statement may be used per instance, and this form takes no other | |
#parameter. | |
mode http | |
#Set the running mode or protocol of the instance | |
#The instance will work in HTTP mode. The client request will be | |
#analyzed in depth before connecting to any server. Any request | |
#which is not RFC-compliant will be rejected. Layer 7 filtering, | |
#processing and switching will be possible. This is the mode which | |
#brings HAProxy most of its value. | |
option httplog | |
#Enable logging of HTTP request, session state and timers | |
option dontlognull | |
#Enable or disable logging of null connections | |
retries 3 | |
#Set the number of retries to perform on a server after a connection failure | |
option redispatch | |
#Enable or disable session redistribution in case of connection failure | |
maxconn 2000 | |
#Fix the maximum number of concurrent connections on a frontend | |
#This value should not exceed the global maxconn | |
contimeout 5000 | |
#Set the maximum time to wait for a connection attempt to a server to succeed. | |
clitimeout 50000 | |
#Set the maximum inactivity time on the client side. | |
#An unspecified timeout results in an infinite timeout, which | |
#is not recommended. Such a usage is accepted and works but reports a warning | |
#during startup because it may results in accumulation of expired sessions in | |
#the system if the system's timeouts are not configured either. | |
srvtimeout 50000 | |
#Set the maximum inactivity time on the server side. | |
#balance roundrobin | |
#NO NEED TO ENABLE. IT'S THE DEFAULT - krams | |
#The load balancing algorithm of a backend is set to roundrobin when no other | |
#algorithm, mode nor option have been set | |
frontend http-in | |
bind *:80 | |
#Define one or several listening addresses and/or ports in a frontend | |
default_backend servers | |
#Specify the backend to use when no "use_backend" rule has been matched | |
backend servers | |
option httpchk OPTIONS / | |
#Enable HTTP protocol to check on the servers health | |
option forwardfor | |
#Enable insertion of the X-Forwarded-For header to requests sent to servers | |
#Since HAProxy works in reverse-proxy mode, the servers see its IP address as | |
#their client address. This is sometimes annoying when the client's IP address | |
#is expected in server logs. To solve this problem, the well-known HTTP header | |
#"X-Forwarded-For" may be added by HAProxy to all requests sent to the server. | |
stats enable | |
#Enable statistics reporting with default settings | |
stats refresh 10s | |
#Enable statistics with automatic refresh | |
stats hide-version | |
#Enable statistics and hide HAProxy version reporting | |
stats scope . | |
# Enable statistics and limit access scope | |
stats uri /admin?stats | |
#Enable statistics and define the URI prefix to access them | |
stats realm Haproxy\ Statistics | |
#Enable statistics and set authentication realm | |
#<realm> is the name of the HTTP Basic Authentication realm reported to | |
#the browser. The browser uses it to display it in the pop-up | |
#inviting the user to enter a valid username and password. | |
stats auth admin:pass | |
#Enable statistics with authentication and grant access to an account | |
cookie JSESSIONID prefix | |
#Enable cookie-based persistence in a backend | |
#server <name> <address>[:port] [param*] | |
#Please refer to section 5 for more details. | |
server tomcat1 127.0.0.1:8080 cookie JSESSIONID_SERVER_1 check inter 5000 | |
server tomcat2 127.0.0.1:8180 cookie JSESSIONID_SERVER_2 check inter 5000 | |
#Declare a server in a backend | |
#server <name> <address>[:port] [param*] | |
#<param*> is a list of parameters for this server. The "server" keywords | |
#accepts an important number of options and has a complete section | |
#dedicated to it. Please refer to section 5 for more details. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment