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
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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,

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