Question

Keep getting 500 error after enabling SSL

I spun off a new droplet & migrated the DNS. The website worked fine, went ahead and added SSL from Lets Encrypt following the steps here: https://www.digitalocean.com/community/tools/nginx

Managed to successfully follow all the steps, but now my website keeps giving an HTTP 500 error ->

rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 49.207.200.121, server: www.epichiringcourse.com, request: "GET / HTTP/2.0", host: "www.epichiringcourse.com"

My conf file for the same:

server {
    listen                  443 ssl http2;
    listen                  [::]:443 ssl http2;
    server_name             www.epichiringcourse.com;
    set                     $base /var/www/epichiringcourse.com;
    root                    $base/public;

    # SSL
    ssl_certificate         /etc/letsencrypt/live/epichiringcourse.com/fullchain.pem;
    ssl_certificate_key     /etc/letsencrypt/live/epichiringcourse.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/epichiringcourse.com/chain.pem;

    # security
    include                 nginxconfig.io/security.conf;

    # logging
    error_log               /var/log/nginx/epichiringcourse.com.error.log warn;

    # index.html fallback
    location / {
        try_files $uri $uri/ /index.nginx-debian.html;
    }

    # additional config
    include nginxconfig.io/general.conf;

    # handle .php
    location ~ \.php$ {
        include nginxconfig.io/php_fastcgi.conf;
    }
}

# non-www, subdomains redirect
server {
    listen                  443 ssl http2;
    listen                  [::]:443 ssl http2;
    server_name             .epichiringcourse.com;

    # SSL
    ssl_certificate         /etc/letsencrypt/live/epichiringcourse.com/fullchain.pem;
    ssl_certificate_key     /etc/letsencrypt/live/epichiringcourse.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/epichiringcourse.com/chain.pem;
    return                  301 https://www.epichiringcourse.com$request_uri;
}

# HTTP redirect
server {
    listen      80;
    listen      [::]:80;
    server_name .epichiringcourse.com;
    include     nginxconfig.io/letsencrypt.conf;

    location / {
        return 301 https://www.epichiringcourse.com$request_uri;
    }
}

I have also confirmed that var/www/html/index.nginx-debian.html exists!

Not sure, what I am missing.


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Accepted Answer

Hi there @adnantlkn,

What I could suggest is checking your Nginx error log file for that domain name for some more information besides the generic 500 Nginx error.

To do that you can run the following command:

  1. sudo tail -100 /var/log/nginx/epichiringcourse.com.error.log

Feel free to share the log here as well so that I could try to advise you further.

Regards, Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel