Created
June 11, 2012 15:55
-
-
Save doomhz/2910803 to your computer and use it in GitHub Desktop.
haproxy config
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
# Install HAProxy | |
cd ~ | |
wget http://haproxy.1wt.eu/download/1.5/src/devel/haproxy-1.5-dev6.tar.gz | |
tar xzf haproxy-1.5-dev6.tar.gz | |
cd haproxy* | |
make install | |
# HAProxy config | |
mkdir /etc/haproxy | |
sudo vim /etc/haproxy/haproxy.cfg | |
# Paste this at the end | |
global | |
maxconn 4096 | |
defaults | |
mode http | |
frontend all 0.0.0.0:80 | |
timeout client 86400000 | |
default_backend www_nodejs | |
acl is_websocket hdr(upgrade) -i websocket | |
acl is_websocket hdr_beg(host) -i ws | |
use_backend www_nodejs if is_websocket | |
backend www_nodejs | |
option forwardfor | |
timeout server 86400000 | |
timeout connect 4000 | |
server nodejs 127.0.0.1:3000 weight 1 maxconn 10000 check | |
# Test haproxy config | |
haproxy -c -f /etc/haproxy/haproxy.cfg | |
# Run HAProxy | |
haproxy -f /etc/haproxy/haproxy.cfg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment