Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
HAProxy config for wordpress
# HAProxy config to block /wp-login.php and wp-admin POST method on wordpress webserver
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 25000
#debug
#quiet
user prod
group prod
defaults
log global
mode http
option tcplog
option dontlognull
option httpclose
retries 3
option redispatch
maxconn 25000
contimeout 5000
clitimeout 50000
srvtimeout 50000
stats enable
stats auth admin:mypassword ##Auth user pass
#begin block end
#Configuration for ravibhure.com
listen VIP:ravibhure.com:172.28.0.17:80
bind 172.28.0.17:80
log global
maxconn 25000
mode http
option forwardfor
balance leastconn
# Here we define the ACL for path & default traffic.
acl url_admin path_beg -i /wp-admin /wp-login.php
acl url_admin hdr(Cookie) admin
acl www_blog hdr_beg(host) -i www. blogs.
block if METH_POST !www_blog
use_backend admin if url_admin
default_backend wp_www
backend admin
server REAL:wpadmin:172.28.0.139:80 172.28.0.139:80 check
backend wp_www
server REAL:wpadmin:172.28.0.139:80 172.28.0.139:80 check
server REAL:wpweb:172.28.0.140:80 172.28.0.140:80 check
#Configuration for images.ravibhure.com
listen VIP:images.ravibhure.com:172.28.0.19:80
bind 172.28.0.19:80
log global
maxconn 25000
mode http
option forwardfor
balance leastconn
server REAL:wpadmin:172.28.0.139:80 172.28.0.139:80 check
server REAL:wpweb:172.28.0.140:80 172.28.0.140:80 check
@kingkool68

This comment has been minimized.

Copy link

@kingkool68 kingkool68 commented Mar 27, 2015

Thanks for sharing. I've been thinking about how to proxy admin requests to a specific server and just looking over your configuration was a big help.

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