Question

Using HaProxy on Nginx server. Not listening to port 80.

Recently setup a server & using haproxy. Everything else runs smoothly but port 80 is not connecting. Here is the haproxy config file. Esp gives problem when certbot tries to renew. what am I missing here?

frontend backend.sample.com
        bind *:80

        # Test URI to see if its a letsencrypt request
        acl letsencrypt-acl path_beg /.well-known/acme-challenge/
        use_backend letsencrypt-backend if letsencrypt-acl
        bind 64.123.456.124:6684 ssl crt /etc/haproxy/certs/backend.sample.com.pem
        default_backend webapps

backend webapps
        balance roundrobin
        server app01 64.123.456.124:5684

backend letsencrypt-backend
   server letsencrypt 127.0.0.1:54321
Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @krishna404,

I’ve had similar issues with certbot and HaProxy. I think due to the Haproxy certbot can’ decide if your SSL is for renewal or not.

The first hurdle to get around arises because LetsEncrypt authorizes a certificate for a server by requesting a file via an HTTP(S) request. However, HAProxy is not a web server. It won’t serve files by itself - it will only redirect a request to another location. Your application servers won’t be able to handle this authorization request.

As such, what you might need is to create a small script that checks for you if your SSL needs to be renewed and then installs a new Let’s Encrypt certificate.