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 server block as well as a Django Project server block. I created both and set up Certbot for the I looked into my sites-available config files and the 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 and edit my config for the Django Project: server as the 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 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

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

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

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
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
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.