阿里云 CentOS7.2 https快速配置

  1. 登陆阿里云账号,进入: SSL证书(应用安全)``
  2. 购买证书,按要求提交审核,等待签发(半个小时就好)
  3. 下载证书,一个.pem文件,一个.key文件
  4. 上传证书,分别上传到nginx/conf/cert/目录下(cert目录自己创建)
  5. .conf文件配置
    • 如果需要同时存在https和http协议,则保留原来的server的配置
server 
	{
        listen       443 ssl;
        server_name  域名;
		index index.html index.htm index.php;
        root  网站根目录;

        ssl_certificate      cert/***.pem;
        ssl_certificate_key  cert/***.key;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        include enable-php.conf;

        location /nginx_status
        {
            stub_status on;
            access_log   off;
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }
        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }
        location ~ /.well-known {
            allow all;
        }
        location ~ /\.
        {
            deny all;
        }
        access_log  /home/wwwlogs/access.log;
    }

  1. 检测配置并重启nginx
nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
systemctl restart nginx.service
  1. 访问带https协议的的指定域名

转载于:https://my.oschina.net/wuxueshi/blog/3045378

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值