[TUTORIAL] Config Dump: Apache Load Balancer (Fail-Over) and Reverse Proxy

Jul 24, 2023
3
3
3
config dump from our running and working apache reverse proxy with load balancer config in case someone needs it.

needed apache modules:
Code:
proxy_http
proxy_balancer
lbmethod_byrequests

vhost config:

Code:
<VirtualHost *:443>

    ServerName PROXMOX.DOMAIN.TLD

    ServerSignature Off
    TraceEnable Off

    LogLevel Warn
    ErrorLog /var/log/apache2/error.log
    CustomLog /var/log/apache2/access.log combined


    <Location /*>

        Order allow,deny
        Allow from 192.168.0.0/16

    </Location>


    <IfModule mod_proxy_balancer.c>

    <Proxy balancer://proxmox>
        BalancerMember https://PROXMOX-1.DOMAIN.TLD:8006
        BalancerMember https://PROXMOX-2.DOMAIN.TLD:8006 status=+H
        ProxySet lbmethod=byrequests
    </Proxy>

    </IfModule>


    <IfModule mod_proxy.c>

    ProxyPreserveHost On
    ProxyRequests Off
    ProxyErrorOverride On

    SSLProxyEngine On

    SetEnv force-proxy-request-1.0 1
    SetEnv proxy-nokeepalive 1

    SSLProxyVerify none
    SSLProxyCheckPeerCN off
    SSLProxyCheckPeerName off
    SSLProxyCheckPeerExpire off

    ProxyPass "/" "balancer://proxmox/"
    ProxyPassReverse "/" "balancer://proxmox/"

    </IfModule>


    <IfModule mod_ssl.c>

    SSLCertificateFile /etc/letsencrypt/live/PROXMOX.DOMAIN.TLDfullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/PROXMOX.DOMAIN.TLDprivkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf

    </IfModule>


</VirtualHost>

option "status=+H" in BalancerMember number 2 (or any following servers) enables fail-over. this host(s) are only used if the none "status=+H" server fails to answer.
 
Last edited:
Thanks for sharing this!

If it works fine - I think the tag '[TUTORIAL]' would be more fitting here than '[SOLVED]' (you can change that by clicking 'Edit Thread' above your top post.

Thanks again!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!