Created
September 9, 2015 14:56
-
-
Save drmalex07/974c701a48655f332a55 to your computer and use it in GitHub Desktop.
Example configuration for wordpress under HAProxy
This file contains hidden or 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
## Frontend | |
frontend http-in | |
bind 0.0.0.0:80 | |
reqadd X-Forwarded-Proto:http | |
acl host-is-foo hdr(host) -i foo.example.com www.foo.example.com | |
acl path-content path_beg /content | |
acl path-content-login path /content/wp-login.php | |
acl path-content-admin path_beg /content/wp-admin | |
redirect scheme https if host-is-foo path-content-login | |
redirect scheme https if host-is-foo path-content-admin | |
use_backend backend-wordpress if host-is-foo path-content | |
# more ... | |
frontend https-in | |
bind 0.0.0.0:443 ssl crt /etc/haproxy/cert.pem | |
reqadd X-Forwarded-Proto:https | |
acl host-is-foo hdr(host) -i foo.example.com www.foo.example.com | |
acl path-content path_beg /content | |
acl path-content-login path /content/wp-login.php | |
acl path-content-admin path_beg /content/wp-admin | |
acl path-content-inc path_beg /content/wp-includes /content/wp-content/plugins /content/wp-content/themes | |
redirect scheme http if host-is-foo path-content !path-content-login !path-content-admin !path-content-inc | |
use_backend backend-wordpress if host-is-foo path-content | |
# more ... | |
## Backend | |
backend backend-wordpress | |
option forwardfor | |
server node1 wp-1.local:80 check weight 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment