Сертификат выпустил, в целом все работает нормально, сайт доступен по https, но проблема в том что если к нему обратиться по http он открывается без сертификата и не происходит редиректа
Конфиг nginx:
server {
listen 80;
listen [::]:80;
root /var/www/mydomain.ru/site_nuxt;
index index.html;
server_name mydomain.ru;
gzip on;
gzip_types text/plain application/xml text/css application/javascript;
gzip_min_length 1000;
error_page 497 301 =307 https://$host:$server_port$request_uri;
location / {
add_header Access-Control-Allow-Origin *;
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
proxy_ssl_certificate /etc/letsencrypt/live/mydomain.ru/fullchain.pem;
proxy_ssl_certificate_key /etc/letsencrypt/live/mydomain.ru/privkey.pem;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Ssl on;
}
location ~ /\.ht {
deny all;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mydomain.ru/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mydomain.ru/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 = mydomain.ru) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name mydomain.ru;
listen 80;
return 404; # managed by Certbot
}