0

I am trying to configure my Nginx server to act as my primary load balancer. I have done the necessary package installation with certbot but the problem comes in when I try to configure my haproxy.cfg file.

All the default haproxy configuratins are left untouched , so i added these lines

frontend www-https-frontend
    bind *:80
    bind *:443 ssl crt /etc/letsencrypt/archive/www.example.tech/fullchain.pem
    http-request redirect scheme https unless { ssl_fc }
    http-request set-header X-Forwarded-Proto https

    default_backend www-backend

backend www-backend
    balance roundrobin
    server web-01 54.90.15.228:80 check
    server web-02 35.153.66.157:80 check

But when I run sudo haproxy -c -f /etc/haproxy/haproxy.cfg, I get this error:

[NOTICE]   (70084) : haproxy version is 2.5.14-1ppa1~focal
[NOTICE]   (70084) : path to executable is /usr/sbin/haproxy
[ALERT]    (70084) : config : parsing [/etc/haproxy/haproxy.cfg:39] : 'bind *:443' : unable to stat SSL certificate from file '/etc/letsencrypt/archive/www.codingbro.tech/fullchain.pem' : No such file or directory.
[ALERT]    (70084) : config : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
[ALERT]    (70084) : config : Fatal errors found in configuration.

When the certificate was generated they provided this exact path for the fullchain /etc/letsencrypt/archive/www.example.tech/fullchain.pem. Any help would be much appreciated

1
  • Have you verified that the file /etc/letsencrypt/archive/www.codingbro.tech/fullchain.pem does, in fact, exist? That's not clear from your question. Commented Jul 8, 2023 at 19:25

1 Answer 1

0

Generally you should not use the archive directory. The current ssl files are symlinked so that is what should be used. For nginx I think the cfg statements would be:

ssl_certificate     /etc/letsencrypt/live/www.example.tech/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.example.tech/privkey.pem

Afraid I don't know what the haproxy equivilent would be.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.