Skip to content

Instantly share code, notes, and snippets.

@CharlieSu
Created September 28, 2010 14:05
Show Gist options
  • Save CharlieSu/601050 to your computer and use it in GitHub Desktop.
Save CharlieSu/601050 to your computer and use it in GitHub Desktop.
<VirtualHost *:80>
ServerAdmin csullivan@integrityemr.com
#ServerName haproxy.integritylogin.com
DocumentRoot /var/www/
ErrorLog /var/log/apache2/haproxy-error.log
# Redirect 301 / https://uat.integritydigitalsolutions.com/SledgeHammer
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>
<VirtualHost *:443>
# Redirect DocRoot to SledgeHammer
RewriteEngine on
RewriteRule ^/$ /SledgeHammer/ [R]
ServerAdmin csullivan@integrityemr.com
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile /etc/apache2/ssl/integritylogin.com.crt
SSLCertificateKeyFile /etc/apache2/ssl/integritylogin.com.key
SSLCertificateChainFile /etc/apache2/ssl/gd_bundle.crt
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel info
ErrorLog /var/log/apache2/haproxy-error.log
CustomLog /var/log/apache2/haproxy-access.log combined
<Location />
Order allow,deny
Allow from all
</Location>
ProxyPreserveHost On
ProxyPass /SledgeHammer http://localhost:10000/SledgeHammer
ProxyPassReverse /SledgeHammer http://localhost:10000/SledgeHammer
</VirtualHost>
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
user haproxy
group haproxy
daemon
node i-8983b8e3
stats socket /var/run/haproxy.stat mode 600
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
option forwardfor
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
listen stats :8080
mode http
stats uri /
frontend https-in
bind *:10000
acl is_qa url_reg _qa
use_backend build_446 if is_qa
default_backend build_446
#Request Headers
capture request header Content-Length len 10
capture request header X-Forwarded-For len 150
capture request header X-Forwarded-Host len 150
#Response Headers
capture response header Content-Length len 10
capture response header X-Forwarded-For len 150
capture response header X-Forwarded-Host len 150
backend build_446 ### QA ###
balance roundrobin
option httpchk HEAD /SledgeHammer/images/chk.gif HTTP/1.0
server i-0f626e65 ec2-75-101-189-211.compute-1.amazonaws.com:8080 check inter 2000 rise 2 fall 5
server i-93969bf9 ec2-184-73-35-29.compute-1.amazonaws.com:8080 check inter 2000 rise 2 fall 5
backend build_85 ### PRODUCTION ###
balance roundrobin
option httpchk HEAD /SledgeHammer/images/chk.gif HTTP/1.0
@CharlieSu
Copy link
Author

The Apache configuration file is pretty much static, but the HAProxy configuration file is automatically built by the Chef server based on the servers available.

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