Skip to content

Instantly share code, notes, and snippets.

@solar
Created October 17, 2012 06:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save solar/3904048 to your computer and use it in GitHub Desktop.
Save solar/3904048 to your computer and use it in GitHub Desktop.
install haproxy with supervisord
# Configurations for haproxy
global
maxconn 4096
chroot /var/haproxy
user haproxy
group haproxy
log 127.0.0.1 local0 alert
stats socket /var/haproxy/stats.socket
defaults
mode http
timeout connect 10s
timeout client 30s
timeout server 30s
balance roundrobin
log global
option httplog
frontend http
bind *:80
option forwardfor
option http-server-close
option http-pretend-keepalive
timeout http-request 20s
timeout http-keep-alive 5s
default_backend default
acl path:hoge path_reg ^/hoge(/.*)?$
use_backend nginx if path:hoge
backend default
redirect location http://google.com/
backend nginx
server nx01 nx01:8080 weight 1 maxconn 1024
server nx02 nx02:8080 weight 1 maxconn 1024
[program:haproxy]
command=/usr/local/sbin/haproxy -f /etc/haproxy.conf -n 4096 -N 4096
autostart=true
autorestart=true
user=root
#!/usr/local/bin/zsh
curl -sL http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.22.tar.gz | tar zx
cd haproxy-1.4.22/
make TARGET=linux2628 CPU=native URE_PCRE=1
sudo make PREFIX=/usr/local/haproxy/1.4.22 install
cd ../
rm -rf haproxy-1.4.22/
sudo alternatives --install /usr/local/sbin/haproxy haproxy /usr/local/haproxy/1.4.22/sbin/haproxy 10422 \
--slave /usr/local/share/man/man1/haproxy.1 man-haproxy.1 /usr/local/haproxy/1.4.22/share/man/man1/haproxy.1
sudo groupadd haproxy
sudo useradd -r -g haproxy haproxy
sudo mkdir -p /var/haproxy /etc/supervisord.d /var/log/haproxy
sudo chown -R haproxy:haproxy /var/haproxy
sudo cp ./haproxy.ini /etc/supervisord.d/
sudo cp ./haproxy.conf /etc/
@tobowers
Copy link

tobowers commented Mar 3, 2015

doesn't this prevent you from doing a reload using the -sf command?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment