1.进入nginx安装目录,进入config文件夹编辑nginx.conf文件
vim nginx.conf
配置端口 443
listen 443 http2 ssl default_server; ssl_certificate /etc/nginx/ssl/chain.pem; #ssl证书 ssl_certificate_key /etc/nginx/ssl/private.key; #ssl密钥 ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:a!NULL:!MD5:!ADH:!RC4;
ssl_session_timeout 50m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on;
监听80端口,并重定向到443
server { listen 80; server_name xxx.com.co; rewrite ^(.*)$ https://${server_name}$1 permanent;
#rewrite ^(.*)$ https://$host$1 permanent;
}
标签:ssl,nginx,443,server,Nginx,https,80 From: https://www.cnblogs.com/eternality/p/16935472.html