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.

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.

×
1 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:

  • 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

  • Hey Bobby, thank you for your reply. Sadly, the error log also doesn’t really provide much more info. Here is the log:

    2020/09/29 13:25:20 [error] 38179#38179: *73 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 85.215.2.227, server: www.epichiringcourse.com, request: "GET / HTTP/1.1", host: "159.89.169.43"
    2020/09/29 13:25:35 [error] 38179#38179: *79 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 85.215.2.227, server: www.epichiringcourse.com, request: "GET / HTTP/2.0", host: "www.epichiringcourse.com"
    2020/09/29 13:25:35 [error] 38179#38179: *79 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 85.215.2.227, server: www.epichiringcourse.com, request: "GET / HTTP/2.0", host: "www.epichiringcourse.com"
    2020/09/29 13:25:36 [error] 38179#38179: *79 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 85.215.2.227, server: www.epichiringcourse.com, request: "GET / HTTP/2.0", host: "www.epichiringcourse.com"
    2020/09/29 13:25:36 [error] 38179#38179: *79 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 85.215.2.227, server: www.epichiringcourse.com, request: "GET / HTTP/2.0", host: "www.epichiringcourse.com"
    2020/09/29 13:47:42 [error] 38179#38179: *83 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 121.36.137.19, server: www.epichiringcourse.com, request: "GET / HTTP/1.1", host: "www.epichiringcourse.com"
    2020/09/29 13:57:31 [error] 38179#38179: *84 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.110, server: www.epichiringcourse.com, request: "GET /collections/archived/products/ilf-bra?variant=46713211155 HTTP/1.1", host: "vigneashsundar.com"
    2020/09/29 14:24:15 [error] 38179#38179: *94 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.113, server: www.epichiringcourse.com, request: "GET / HTTP/1.1", host: "www.epichiringcourse.com"
    2020/09/29 14:27:17 [error] 38179#38179: *95 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 69.25.58.53, server: www.epichiringcourse.com, request: "GET / HTTP/2.0", host: "www.epichiringcourse.com"
    2020/09/29 14:27:18 [error] 38179#38179: *99 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 69.25.58.53, server: www.epichiringcourse.com, request: "GET / HTTP/2.0", host: "www.epichiringcourse.com"
    2020/09/29 14:27:22 [error] 38179#38179: *102 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 23.19.37.232, server: www.epichiringcourse.com, request: "GET / HTTP/2.0", host: "www.epichiringcourse.com"
    2020/09/29 14:27:23 [error] 38179#38179: *103 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 23.19.37.25, server: www.epichiringcourse.com, request: "GET / HTTP/2.0", host: "www.epichiringcourse.com"
    2020/09/29 14:27:30 [error] 38179#38179: *105 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 98.127.125.208, server: www.epichiringcourse.com, request: "GET / HTTP/2.0", host: "www.epichiringcourse.com"
    2020/09/29 14:27:31 [error] 38179#38179: *106 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 69.25.58.53, server: www.epichiringcourse.com, request: "GET / HTTP/2.0", host: "www.epichiringcourse.com"
    2020/09/29 14:27:34 [error] 38179#38179: *110 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 69.25.58.53, server: www.epichiringcourse.com, request: "GET / HTTP/2.0", host: "www.epichiringcourse.com"
    2020/09/29 14:28:33 [error] 38179#38179: *121 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 64.222.84.197, server: www.epichiringcourse.com, request: "GET /privkey.pem HTTP/1.1", host: "www.epichiringcourse.com"
    2020/09/29 14:28:33 [error] 38179#38179: *123 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 24.220.112.6, server: www.epichiringcourse.com, request: "GET / HTTP/1.1", host: "www.epichiringcourse.com"
    2020/09/29 14:28:33 [error] 38179#38179: *124 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 192.232.16.9, server: www.epichiringcourse.com, request: "GET / HTTP/1.1", host: "www.epichiringcourse.com"
    2020/09/29 14:28:33 [error] 38179#38179: *122 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 216.21.170.10, server: www.epichiringcourse.com, request: "GET / HTTP/1.1", host: "www.epichiringcourse.com"
    2020/09/29 14:28:33 [error] 38179#38179: *125 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 209.141.121.132, server: www.epichiringcourse.com, request: "GET /chain.pem HTTP/1.1", host: "www.epichiringcourse.com"
    2020/09/29 14:28:40 [error] 38179#38179: *127 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 74.125.210.112, server: www.epichiringcourse.com, request: "GET / HTTP/1.1", host: "www.epichiringcourse.com"
    2020/09/29 14:28:41 [error] 38179#38179: *129 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 74.125.210.108, server: www.epichiringcourse.com, request: "GET / HTTP/1.1", host: "www.epichiringcourse.com"
    2020/09/29 14:28:41 [error] 38179#38179: *130 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 74.125.210.112, server: www.epichiringcourse.com, request: "GET / HTTP/1.1", host: "www.epichiringcourse.com"
    2020/09/29 14:32:39 [error] 38179#38179: *132 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 94.21.255.135, server: www.epichiringcourse.com, request: "GET / HTTP/1.1", host: "www.epichiringcourse.com"
    2020/09/29 14:38:33 [error] 38179#38179: *134 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 207.237.69.70, server: www.epichiringcourse.com, request: "GET /fullchain.pem HTTP/1.1", host: "www.epichiringcourse.com"
    2020/09/29 14:57:25 [error] 38179#38179: *135 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.108, server: www.epichiringcourse.com, request: "GET /collections/outer/products/southpaw-hoodie HTTP/1.1", host: "vigneashsundar.com"
    2020/09/29 14:58:26 [error] 38179#38179: *136 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.108, server: www.epichiringcourse.com, request: "GET /collections/outer/products/southpaw-hoodie HTTP/1.1", host: "vigneashsundar.com"
    2020/09/29 14:59:27 [error] 38179#38179: *137 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.110, server: www.epichiringcourse.com, request: "GET /collections/outer/products/southpaw-hoodie HTTP/1.1", host: "vigneashsundar.com"
    2020/09/29 15:00:28 [error] 38179#38179: *138 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.108, server: www.epichiringcourse.com, request: "GET /collections/outer/products/southpaw-hoodie HTTP/1.1", host: "vigneashsundar.com"
    2020/09/29 15:06:55 [error] 38179#38179: *139 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.108, server: www.epichiringcourse.com, request: "GET /collections/bodysuits/products/kaat-bodysuit HTTP/1.1", host: "vigneashsundar.com"
    2020/09/29 15:07:09 [error] 38179#38179: *141 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 119.40.126.228, server: www.epichiringcourse.com, request: "GET /fullchain.pem HTTP/1.1", host: "www.epichiringcourse.com"
    2020/09/29 15:07:55 [error] 38179#38179: *142 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.108, server: www.epichiringcourse.com, request: "GET /collections/bodysuits/products/kaat-bodysuit HTTP/1.1", host: "vigneashsundar.com"
    2020/09/29 15:08:56 [error] 38179#38179: *143 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.110, server: www.epichiringcourse.com, request: "GET /collections/bodysuits/products/kaat-bodysuit HTTP/1.1", host: "vigneashsundar.com"
    2020/09/29 15:09:32 [error] 38179#38179: *145 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 54.221.27.173, server: www.epichiringcourse.com, request: "GET / HTTP/1.1", host: "www.epichiringcourse.com", referrer: "http://epichiringcourse.com"
    2020/09/29 15:09:57 [error] 38179#38179: *146 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.106, server: www.epichiringcourse.com, request: "GET /collections/bodysuits/products/kaat-bodysuit HTTP/1.1", host: "vigneashsundar.com"
    2020/09/29 15:22:37 [error] 38179#38179: *149 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 103.22.242.4, server: www.epichiringcourse.com, request: "GET / HTTP/1.1", host: "www.epichiringcourse.com"
    2020/09/29 15:23:42 [error] 38179#38179: *150 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.108, server: www.epichiringcourse.com, request: "GET /collections/engraved/products/selene-necklace HTTP/1.1", host: "vigneashsundar.com"
    2020/09/29 15:26:14 [error] 38179#38179: *153 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"
    2020/09/29 15:46:37 [error] 38179#38179: *158 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 67.219.192.37, server: www.epichiringcourse.com, request: "GET /chain.pem HTTP/1.1", host: "www.epichiringcourse.com"
    2020/09/29 15:52:16 [error] 38179#38179: *162 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 87.121.47.67, server: www.epichiringcourse.com, request: "GET / HTTP/2.0", host: "www.epichiringcourse.com"
    2020/09/29 15:52:29 [error] 38179#38179: *162 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 87.121.47.67, server: www.epichiringcourse.com, request: "GET / HTTP/2.0", host: "www.epichiringcourse.com"
    2020/09/29 15:52:35 [error] 38179#38179: *162 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 87.121.47.67, server: www.epichiringcourse.com, request: "GET / HTTP/2.0", host: "www.epichiringcourse.com"
    2020/09/29 15:57:25 [error] 38179#38179: *168 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.108, server: www.epichiringcourse.com, request: "GET /collections/archived/products/ilf-bra?variant=46713211155 HTTP/1.1", host: "vigneashsundar.com"
    2020/09/29 15:58:08 [error] 38179#38179: *169 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.108, server: www.epichiringcourse.com, request: "GET /products/maika-swim-top HTTP/1.1", host: "vigneashsundar.com"
    2020/09/29 15:59:09 [error] 38179#38179: *170 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.106, server: www.epichiringcourse.com, request: "GET /products/maika-swim-top HTTP/1.1", host: "vigneashsundar.com"
    2020/09/29 16:00:10 [error] 38179#38179: *171 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.110, server: www.epichiringcourse.com, request: "GET /products/maika-swim-top HTTP/1.1", host: "vigneashsundar.com"
    2020/09/29 16:01:11 [error] 38179#38179: *172 rewrite or internal redirection cycle while internally redirecting to "/index.nginx-debian.html", client: 66.249.70.110, server: www.epichiringcourse.com, request: "GET /products/maika-swim-top HTTP/1.1", host: "vigneashsundar.com"
    
    
    • Hi there @adnantlkn,

      Thanks for sharing the log, with that and after another look into your config file, it looks like that your document root is set to /var/www/epichiringcourse.com/public, and the index index.nginx-debian.html file is at var/www/html/.

      Is there an index.nginx-debian.html file inside the /var/www/epichiringcourse.com/public directory?

      If not, you can create one with the following command:

      • touch /var/www/epichiringcourse.com/public/index.nginx-debian.html

      Let me know how it goes!

      Regards,
      Bobby

Submit an Answer