Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. https://crt.sh/?q=example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.
I ran this command: certbot certonly -w /var/www/html -d domain.com
It produced this output: Unable to find a virtual host listening on port 80 which is currently needed for Certbot to prove to the CA that you control your domain. Please add a virtual host for port 80.
My web server is (include version): Ubuntu 22.04
The operating system my web server runs on is (include version): Linux Ubuntu
My hosting provider, if applicable, is: Amazon Web server
I can login to a root shell on my machine (yes or no, or I don't know): yes
I'm using a control panel to manage my site (no, or provide the name and version of the control panel): No
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):certbot 1.21.0
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for carglasspart.com
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/carglasspart.com/fullchain.pem
Key is saved at: /etc/letsencrypt/live/carglasspart.com/privkey.pem
This certificate expires on 2023-03-29.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
If you like Certbot, please consider supporting our work by:
Terrific. Since you used certonly you got the cert. Now you need to configure your Apache to use it. The Mozilla SSL Configurator is often helpful (link here)
That proves you can get a cert but I don't think that is best way forward. I think you should create a VirtualHost for port 80 and use the --apache plug-in. Do not use certonly. When --apache works it will configure a VirtualHost for port 443 (https) for you.
Refer to the Ubuntu link I provided earlier on how to do that
*:443 is a NameVirtualHost
default server carglasspart (/etc/apache2/sites-enabled/carglasspart.conf:2)
port 443 namevhost carglasspart (/etc/apache2/sites-enabled/carglasspart.conf:2)
port 443 namevhost www.carglasspart.com (/etc/apache2/sites-enabled/www.carglasspart.conf:2)
i ran the command 1. sudo certbot renew --dry-run
it was successfully done but still my site is showing the error i have pasted above.
You have overlapping virtualhosts. The configuration file carglasspart.conf as well as www.carglasspart.conf have a virtual host for www.carglasspart.com. You should combine the contents of both into a single working configuration file.