Linux----阿里云服务器 https 配置(目前用的是1年免费 SSL证书申请)

操作步骤

步骤1:登录阿里后台 –> 证书服务 –> 点击购买证书(像商品购买)
步骤2:购买后按提示绑定域名,提交等待审核(一般20分钟左右)
步骤3:审核通过后,在我的证书订单列表中点击下载,进入选择下载对应不同服务器类型(apache, nginx, iss…)的证书文件(.pem, .key)
步骤4:按提示的配置信息,上传刚下载的两个证书文件到服务器,并配置nginx.conf
步骤5:nginx.conf 配置文件中添加:注要监听443 商品

配置文件:

server {
    # 监听443 端口
    listen 443;
    server_name www.xxx.com xxx.com;
    ssl on;
#   root html;
#   index index.html index.htm;
    # 证书路径
    ssl_certificate   /alidata/server/nginx-1.4.4/conf/cert/214134739980111.pem;
    # 私钥路径
    ssl_certificate_key  /alidata/server/nginx-1.4.4/conf/cert/214134739980111.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;



#   自定义部分, 注释了模板上面的二行
    index index.html index.htm index.php;
    root /alidata/www/www.xxx.com;

    error_page 404 /404.html;

    location ~ .*\.(php|php5)?$
    {
            #fastcgi_pass  unix:/tmp/php-cgi.sock;
            fastcgi_pass  127.0.0.1:9000;
            fastcgi_index index.php;
            include fastcgi.conf;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
            expires 30d;
    }
    location ~ .*\.(js|css)?$
    {
            expires 1h;
    }

    # rewrite, log
    include /alidata/server/nginx/conf/rewrite/www.xxx.com.conf;
    access_log  /alidata/log/nginx/access/www.xxx.com.log;
}

步骤6: 重启服务: /etc/init.d/nginx restart

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值