网站由http切换到https

时间:2022-10-30 14:20:04

参考教程

https://www.dexcoder.com/selfly/article/4949;jsessionid=484F40F28718AE7BC9B5F0988AACD0CE

https://imququ.com/post/letsencrypt-certificate.html


自带备注

openssl req -new -sha256 -key domain.key -subj "/" -reqexts SAN -config <(cat /etc/pki/tls/openssl.cnf <(printf "[SAN]\nsubjectAltName=DNS:flyonline.top,DNS:www.flyonline.top")) > domain.csr


server
{
    listen       80;
    server_name  www.flyonline.top;


    location ^~ /.well-known/acme-challenge/ {
            alias /home/ec2-user/ssl/challenges/;
    }
    location / {
            return 301 https://$server_name$request_uri;
    }
}


server
{
    listen       443;
    server_name  www.flyonline.top;
ssl on;
    ssl_certificate /home/ec2-user/ssl/chained.pem;
    ssl_certificate_key /home/ec2-user/ssl/domain.key;
}


python acme_tiny.py --account-key ./account.key --csr ./domain.csr --acme-dir /home/ec2-user/ssl/challenges/ > ./signed.crt