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

Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.