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

Become a contributor for community

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

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.