Hello, I set up a droplet and configured nginx to serve a small static website. Everything was working fine until I installed a certificate using the Certbot script.
This is the nginx configuration file for the website:
server {
root /var/www/angelacapillo.com;
index index.php index.html index.htm;
server_name angelacapillo.com www.angelacapillo.com;
location / {
try_files $uri $uri/ =404;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/angelacapillo.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/angelacapillo.com/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 = www.angelacapillo.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = angelacapillo.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name angelacapillo.com www.angelacapillo.com;
listen 80;
return 404; # managed by Certbot
}
Following their instructions, I tested the certificate here but I get an error: https://www.ssllabs.com/ssltest/analyze.html?d=www.angelacapillo.com
What might be the issue?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello @qarlo,
The syntax of your configuration file looks fine. What I could suggest here is:
Syntax OK
restart Nginx:Hope that this helps! Regards, Bobby
For the benefit of future readers, I had the same issue after installing the Lets encrypt certificate using certbot.
Attempts to reload/restart nginx failed with errors already documented in this thread. systemctl status nginx showed that the nginx service had failed starting.
Because DO Firewall was in place, ufw was inactive.
Checking the ports showed that nginx processes were (still/already) listening to the port 443.
Rebooting the ubuntu server resolved the issue.