And those are the only 3 files in that folder? If so, makes no sense to me how haproxy can be using such an old cert.
You should inspect your system to locate the file(s) related to that old cert. Then identify what is referencing those files. Those files must be somewhere being used by something on your system.
You might even look at the haproxy and apache access logs after making a request to the test subdomain. Make sure those requests show up in the servers they should be.
No. My haproxy is handling certs just fine. And I am not using nginx.
I am using LXC containers. I have ports 80 and 443 on the host forwarding to my haproxy container. The haproxy forwards the sub-domain to the proper container. Works like a champ.
My concern is I have one website that is not using the correct cert. It is using the expired cert instead of the renewed cert. So let's trouble shoot why the expired cert is being used and not the renewed cert.
Let's not be concerned about the infrastructure (LXD containers) I am using. It works fine.
I don't know how we could help debug without understanding the infrastructure
Which component(s) terminate(s) TLS? And, what entity is reporting the expired cert?
For example, in a typical reverse proxy the proxy itself terminates HTTPS from client requests like a browser on the 'net (using a cert). The proxy server uses a second connection to the backend server and that can be HTTP or HTTPS. If HTTP you don't need a cert on that backend at all. If HTTPS you need a cert on that backend server which satisfies whatever the proxy needs for that connection. You could possibly even use a long-lived self-signed cert.
These are the kinds of things we are trying to clarify. Without knowing specifics about what is failing it is hard to give specific advice. Trying to give general advice is impractical because there are so many ways to do things.
Maybe look for files ending in '.pem' ? If you used other naming conventions check those. Learn about using a 'find' command and check any volume / folder they might be. It must be somewhere for your system to be using it.
From sudo find / -name *.pem -print: There are literally thousands of .pem files on my haproxy server in the following folders:
/etc/letsencrypt/archive/
/etc/letsencrypt/csr/
/etc/letsencrypt/keys/
/etc/ssl/certs
/usr/lib/python3/dist-packages/twisted/
A user-agent (like a browser) makes an HTTPS request to connect to your domain.
Your haproxy system sees this request. It looks in its config to find where the cert file is and uses the cert within it for the connection. There is no other place for the cert (and private key) to come from other than your own system.
For some reason your haproxy is using a cert that expired almost 2 years ago. There is really nothing more I can say about this. Your haproxy is either finding that very old cert in some place you don't know. Or, haproxy is not even handling the requests for test domain like it is for your others.
Maybe you have some network router or something that sends HTTPS (port 443) requests for test domain directly to your Apache server. I don't know. There are many ways to setup systems and you need to understand how yours is setup.
You may need to consult with a server and/or network expert or hope for an answer on the haproxy forum.
Problem solved! Apparently there was an expired cert in the haproxy /etc/haproxy/certs folder that was being used for the failing website.
I don't understand how haproxy works. I thought there was a one for one cert for each website? Why haproxy looks at all of the certs is beyond me.