[Unit] Description=HAproxy Loadbalancer After=network-online.target Wants=network-online.target systemd-networkd-wait-online.service [Service] Type=notify KillMode=mixed PIDFile=/run/haproxy/haproxy.pid SuccessExitStatus=143 # User and group User=haproxy Group=haproxy # Environment files EnvironmentFile=-/etc/sysconfig/haproxy # Exec start ExecStartPre=/usr/sbin/haproxy-check ExecStart=/usr/sbin/haproxy -f ${CONFIG} -Ws ExecReload=/usr/sbin/haproxy-check ExecReload=/bin/kill -USR2 ${MAINPID} # Automatic restart Restart=always Restart=on-failure RestartSec=5s # Allow bind to privileged ports ( < 1024 ) AmbientCapabilities=CAP_NET_BIND_SERVICE # Allow more open files for this process LimitNOFILE=65000 LimitNPROC=65000 # Log to file StandardOutput=append:/var/log/haproxy/access.log StandardError=append:/var/log/haproxy/error.log # More threads for this process TasksMax=65000 [Install] WantedBy=multi-user.target Alias=multi-user.target.wants/haproxy.service