Core concepts

Overview

On this page

An HAProxy configuration file is composed of sections like frontend, backend, defaults, and global.

In the example below you can see a basic configuration file’s layout that contains these four sections. Section headers begin at the start of a line and all configuration directives of a section should be indented for readability. Except for global, you can set multiple sections of the same type, such as to load balance different websites and define different pools of backend servers.

haproxy
global
# process-level settings go here
defaults
# default settings go here
frontend listener
# a frontend that accepts requests from clients
backend webservers
# servers that fulfill the requests
haproxy
global
# process-level settings go here
defaults
# default settings go here
frontend listener
# a frontend that accepts requests from clients
backend webservers
# servers that fulfill the requests

You can enable extra functionality by using the various other sections, such as mailers, peers, and resolvers, which we describe in other parts of this guide.

See also Jump to heading

Do you have any suggestions on how we can improve the content of this page?