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
/etc/letsencrypt/archive/www.codingbro.tech/fullchain.pemdoes, in fact, exist? That's not clear from your question.