Newly-installed Let’s Encrypt cert causing 404 on Django site

Linode Staff

I have a Django site set up at example.com, which worked fine until I installed an SSL certificate using Let’s Encrypt. Once I did that, my site goes to a 404. Any suggestions on how to figure this out and fix it?

1 Reply

Hey there! That sounds like a frustrating situation, but there are a few basic steps you can do to narrow down where the issue is. The first and easiest would be looking at the output of a curl command to see which step of the request is generating the 404 response.

Take the following output as an example:

$ curl -IL example.com
HTTP/1.1 301 Moved Permanently
Date: Tue, 23 Apr 2019 21:29:34 GMT
Server: Apache/2.4.29 (Ubuntu)
Location: https://example.com/
Content-Type: text/html; charset=iso-8859-1

HTTP/1.1 404 Not Found
Date: Tue, 23 Apr 2019 21:29:35 GMT
Server: Apache/2.4.29 (Ubuntu)
Content-Type: text/html; charset=iso-8859-1

The above output shows that the HTTP (unsecured) request is being redirected to HTTPS (secured). This is likely due to the changes that Let’s Encrypt made to your configuration, which is expected, and probably what you want in most cases.

The next section of output shows that the HTTPS request is resulting in a 404. This points to the HTTPS configuration within Apache as the likely source of the issue, and you’ll want to compare the configuration sections of your Apache config files to see if there’s a difference between the two sections, and resolve any issues. The Check Virtual Host Definitions section of our Troubleshooting Common Apache Issues is a great place to start, and will show you how to locate and review the configuration files.

If you’re running Nginx instead of Apache, this Community post and our guide on configuring Nginx might help you pin down where the configuration issue is within Nginx.

If you’re still having issues, feel free to share more details below, and consider reaching out to the Django community or the Let’s Encrypt community for help, as they’re the ones best equipped to give you support and direction for their specific products.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct