I have been using certbot for years on Apache2 web server, today was my first installation on an Nginx web server and I am facing some problems; whenever I install the certbot certificate on the below mentioned domain, it gives 404 on the browser, after some investigations I found that by commenting these commands in the domain virtual host file the domain works fine but of course without the certificate so don’t really know what is happening, please advise on how to investigate this issue
This is the section that causes the problem in the virtual host file which is the certificate:
"
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/areej.website/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/areej.website/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = areej.website) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name areej.website;
return 404; # managed by Certbot
}
"
- My domain is: areej.website
- I ran this command: sudo certbot
- It produced this output: It produced the certificate needed for the domain after a few wizard like steps without errors
- My web server is (include version): Nginx - nginx version: nginx/1.17.10 (Ubuntu)
- The operating system my web server runs on is (include version):
Ubuntu 20.04 LTS
Codename:focal - My hosting provider, if applicable, is: DigitalOcean
- 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
orcertbot-auto --version
if you’re using Certbot): certbot 0.40.0