By qarlo
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!
Accepted Answer
Hello @qarlo,
The syntax of your configuration file looks fine. What I could suggest here is:
systemctl status nginx
systemctl start nginx
netstat -plant | grep 443
nginx -t
Syntax OK
restart Nginx:systemctl restart nginx
tail -100 /var/log/nginx/error.log
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.