I'm struggling with setting up a SSL for my EC2 instance on Ubuntu, I did it without any problems on Amazon AMI, but I have some problems with Ubuntu:
certbotnginx.confnginxAnd I have timeout when I'm accessing my site via https, could help me with debugging this issue?
Here is my nginx.conf:
server {
listen 80;
listen [::]:80;
server_name mydomain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name mydomain.com;
root /home/ubuntu/myproject;
add_header Strict-Transport-Security "max-age=15768000";
ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forward-Proto http;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
}
Note: Everything is working via HTTP when I'm disabling redirect in nginx.
As you said this configuration was ok, I've terminated an instance and reinstall nginx and works properly right now.