Question

Certbox installed for Domain Server Block Instead of Django Project

Posted January 8, 2022 72 views
NginxDjangoLet's Encrypt

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.

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.

×
Submit an Answer
1 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