Question

Certbox installed for Domain Server Block Instead of Django Project

I must have been a bit confused as to whether I needed to create a domain.com server block as well as a Django Project server block. I created both and set up Certbot for the domain.com. I looked into my sites-available config files and the domain.com config has certbot configured, whereas the Django Project config file does not. I need to find out whether I should remove the link in sites-enabled for the domain.com and edit my config for the Django Project: server as the domain.com www.domain.com instead of an IP address. Then rerun certbot to install a cert for the Django Project, so that config file shows the certbox configuration. I’m thinking I should only have the Django Project server block, not the domain.com server block as well. Please advise.


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.

Bobby Iliev
Site Moderator
Site Moderator badge
January 8, 2022
Accepted Answer

Hi there,

In case that your domain name has to show the content of the Django project, then it is best to have just a single server block.

What you could do is update the server_name directive for your Django server block and set it to your domain name, after that disable the second server block that has been set up for your domain name only.

Then once you run certbot it would generate a second server block for port 443. That way you would have two server blocks: one for HTTP and one for HTTPS.

Hope that this helps! Best, 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