Nginx配置ssl证书笔记 且配置强跳

# 强制跳转https
 rewrite ^(.*)$  https://$host$1 permanent; #若需要http强调https,则将这个配置配置到http中

修改配置文件Nginx.conf

server {
    
    listen       443 ssl;        #开启443监听端口
    server_name  www.XXX.com;    #例如www.baidu.com

    #https证书
    # ssl on; 如果使用listen 443 ssl,注释ssl on防止warn
    ssl_certificate /XXX1/XX2/XXX3/xxxxxxx.pem;      #证书文件XXX.pem
    ssl_certificate_key /XXX1/XX2/XXX3/xxxxxxx.key;  #证书文件XXX.key
    
    #一下内容为固定配置
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
    ssl_prefer_server_ciphers on;

    # 强制跳转https
   rewrite ^(.*)$  https://$host$1 permanent; #若需要http强调https,则将这个配置配置到http中


    #访问日志
     access_log  /XXX1/XX2/XXX3/logs/xxxxx.log  main buffer=32k flush=5s;

    # 站点配置
    location / {
        root   /home/xxxxx;
        index  index.htm index.html;
    }    

    #公共代理 proxycommon.conf代理配置文件
    include proxycommon.conf;
    # 错误页面/友好提示
    #include error.conf;

}

server {
    
    listen       443 ssl;        #开启443监听端口
    server_name  www.XXX.com;    #例如www.baidu.com

    #https证书
    # ssl on; 如果使用listen 443 ssl,注释ssl on防止warn
    ssl_certificate /XXX1/XX2/XXX3/xxxxxxx.pem;      #证书文件XXX.pem
    ssl_certificate_key /XXX1/XX2/XXX3/xxxxxxx.key;  #证书文件XXX.key
    
    #一下内容为固定配置
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
    ssl_prefer_server_ciphers on;

    # 强制跳转https
   rewrite ^(.*)$  https://$host$1 permanent; #若需要http强调https,则将这个配置配置到http中


    #访问日志
     access_log  /XXX1/XX2/XXX3/logs/xxxxx.log  main buffer=32k flush=5s;

    # 站点配置
    location / {
        root   /home/xxxxx;
        index  index.htm index.html;
    }    

    #公共代理 proxycommon.conf代理配置文件
    include proxycommon.conf;
    # 错误页面/友好提示
    #include error.conf;

}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值