Nginx配置https访问

#将域名证书放在nginx的cert目录下.

server {
        listen       443;
        ssl                  on;
        ssl_certificate      cert/domain.pem;
        ssl_certificate_key  cert/domain.key;
        ssl_prefer_server_ciphers on;
        ssl_session_timeout 10m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
        server_name domain.com;
        index  index.html index.php index.htm;
        location / {

        }
}

#配置访问http时强制跳转到https
server {
        listen       80;
        server_name domain.com;
        rewrite ^(.*)$  https://$host$1 permanent;
        index  index.html index.php index.htm;
}

  

posted @ 2020-10-30 14:14  赵海博运维笔记  阅读(200)  评论(0编辑  收藏  举报