nginx http 80 端口重定向到 https 443 端口
修改 nginx 配置文件
[root@hostname /]# vim /etc/nginx/conf.d/default.conf>
在新增一个server,用于跳转
server { listen 80 default; server_name www.on0926.com on0926.com; rewrite ^(.*)$ https://${server_name}$1 permanent; }
原有的server listen 端口修改为
server { listen 443 ssl; ssl_certificate /路径/名称.pem; ssl_certificate_key /路径/名称.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; server_name www.on0926.com on0926.com; ..... }