Skip to content

Instantly share code, notes, and snippets.

@haproxytechblog
haproxytechblog / blog20190321-01.conf
Last active August 19, 2019 21:38
HAProxy vs NGINX: An Up-to-date Comparison
http {
server {
listen 80;
location / {
proxy_pass http://my_upstream;
}
location /api/ {
proxy_pass http://api_servers;
}
@haproxytechblog
haproxytechblog / blog20190402-01.cfg
Last active April 3, 2019 13:52
Extending HAProxy with the Stream Processing Offload Engine
frontend myproxy
filter spoe [engine <name>] config <spoe-config-file>
@haproxytechblog
haproxytechblog / blog20190412-01.sh
Last active March 3, 2022 21:59
HAProxy Now Exposes a Prometheus Metrics Endpoint
sudo apt update
sudo apt install -y git ca-certificates gcc libc6-dev liblua5.3-dev libpcre3-dev libssl-dev libsystemd-dev make wget zlib1g-dev
git clone https://github.com/haproxy/haproxy.git
cd haproxy
make TARGET=linux-glibc USE_LUA=1 USE_OPENSSL=1 USE_PCRE=1 USE_ZLIB=1 USE_SYSTEMD=1 USE_PROMEX=1
sudo make install-bin
@haproxytechblog
haproxytechblog / blog20181128-01.cfg
Created April 24, 2019 19:57
Dynamic Configuration with the HAProxy Runtime API
global
stats socket ipv4@127.0.0.1:9999 level admin
stats socket /var/run/hapee-lb.sock mode 666 level admin
stats timeout 2m
@haproxytechblog
haproxytechblog / blog20190426-01.sh
Created April 26, 2019 13:31
HAProxy on AWS: Best Practices Part 3
$ apt update
$ apt install -y unzip
$ wget -O ./terraform.zip https://releases.hashicorp.com/terraform/0.11.13/terraform_0.11.13_linux_amd64.zip
$ unzip ./terraform.zip -d ./terraform
$ cp ./terraform/terraform /usr/local/bin
@haproxytechblog
haproxytechblog / 20190510-01.cfg
Last active March 16, 2023 15:56
Exploring the HAProxy Stats Page
frontend stats
mode http
bind *:8404
stats enable
stats uri /stats
stats refresh 10s
stats admin if LOCALHOST
@haproxytechblog
haproxytechblog / blog20190524-01.sh
Last active July 31, 2023 21:50
5 Ways to Extend HAProxy with Lua
$ haproxy -vv | grep Lua
Built with Lua version : Lua 5.3.5
@haproxytechblog
haproxytechblog / blog20190614-01.yaml
Last active January 16, 2023 08:43
Tracing Requests Through HAProxy with AWS X-Ray
TotalBufferSizeMB: 0
Concurrency: 8
Region: "us-east-2"
Endpoint: ""
Socket:
UDPAddress: "127.0.0.1:2000"
TCPAddress: "127.0.0.1:2000"
Logging:
LogRotation: true
LogLevel: "prod"
@haproxytechblog
haproxytechblog / haproxy-config-2-0.cfg
Created June 13, 2019 20:41
HAProxy 2.0 configuration
#
# This is the ultimate HAProxy 2.0 "Getting Started" config
# It demonstrates many of the features available which are now available
# While you may not need all of these things, this can serve
# as a reference for your own configurations.
#
# Have questions? Check out our community Slack:
# https://slack.haproxy.org/
#
@haproxytechblog
haproxytechblog / blog20190616-01.cfg
Last active August 4, 2020 20:44
HAProxy 2.0 and Beyond
log stdout local0
log fd@1 local0
log stdout format raw local0