I am currently deploying my django app on a server AWS Lightsail Debian 10.8. It’s working fine with http. So I wnated to turn my app into HTTPS and getting an SSL certificate. I followed 2 tutorials about it :
Once all these steps done nothing works anymore even in HTTP, the site isn’t accessible… Here is the config file in /etc/nginx/sites-available.
server {
server_name 13.38.76.96 www.zlochteam.com;
location / {
include proxy_params;
proxy_pass http://localhost:8000/;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/www.zlochteam.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.zlochteam.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.zlochteam.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name 13.38.76.96 www.zlochteam.com;
return 404; # managed by Certbot
}
I wanted to know if someone has ecountered the same issue and how he solved it.
Thanks !
3
Answers
Resolved
I just had to allow connection from the port 443 on AWS LightSail, such a dummy error...
Here is where you need to add the HTTPS connection, in the Networking tab.
Before you run the commands in certbot, make sure you have the following in your Nginx:
Seems like certbot now requires the ipv6 as well.
Http has break because the certbot added the redirect
return 301 https://$host$request_uri;
You should test config by command
nginx -t
and then reload confignginx -s reload
.