zoukankan      html  css  js  c++  java
  • Nginx安装SSL安全证书

    1、 在Nginx的安装目录下的config目录下创建cert目录,并且将下载的证书全部文件拷贝到cert目录中。如果申请证书时是自己创建的CSR文件,请将对应的私钥文件放到cert目录下并且命名为20180907.key;
    2、  打开 Nginx 安装目录下 conf 目录中的 nginx.conf 文件,找到:
    HTTPS server配置项,粘贴以下配置

        server {
            listen 443 ssl; #删掉 ssl on; 配置项 ssl写在443端口后面
    
            server_name www.***.com; #你的域名
            
            root html; #你的网站根目录
            index index.php index.html index.htm; #网站默认访问文件
            
            ssl_certificate   cert20180907.pem; #证书文件
            ssl_certificate_key  cert20180907.key; #秘钥文件
            ssl_session_timeout 5m;
            ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
            ssl_prefer_server_ciphers on;
            
            location / {
                root html; #网站根目录
                index index.php index.html index.htm; #网站默认访问文件
            }
            
            location ~ .php(.*)$  { #PHP必须的配置,否则浏览器访问会直接下载php源码文件
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_split_path_info  ^((?U).+.php)(/?.+)$;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                fastcgi_param  PATH_INFO  $fastcgi_path_info;
                fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
                include        fastcgi_params;
            }
        }
    3、  重启Nginx服务器
    4、  使用https域名访问网站
  • 相关阅读:
    lintcode:Flip Bits 将整数A转换为B
    lintcode:strStr 字符串查找
    lintcode:Subtree 子树
    lintcode 容易题:Partition Array by Odd and Even 奇偶分割数组
    lintcode:在二叉查找树中插入节点
    lintcode:在O(1)时间复杂度删除链表节点
    lintcode:哈希函数
    lintcode:合并排序数组 II
    lintcode:合并排序数组
    lintcode:数飞机
  • 原文地址:https://www.cnblogs.com/hui9527/p/9602667.html
Copyright © 2011-2022 走看看