centos7阿里云服务器域名配置https,用的免费Symantec证书

管理员 发布于 3年前   471
  1. 先登录阿里云 进SSL证书->点击购买证书 直接先免费版的

22.png

2.点击申请 填一下信息 过一会状态变成已签发就能用了  

1.png

3.下载证书

2.png

4. 上传证书文件到服务器 一般在nginx安装目录就行自己定 我放在这里

[root@iz8vbcrus31oj2axurgpjyz ~]# cd /usr/local/nginx/conf/cert/
[root@iz8vbcrus31oj2axurgpjyz cert]# ll
total 8
-rw-r--r-- 1 root root 1679 Apr  7 14:37 3641582xxx.key
-rw-r--r-- 1 root root 3675 Apr  7 14:37 3641582xxx.pem
[root@iz8vbcrus31oj2axurgpjyz cert]#

5.配置nginx

[root@iz8vbcrus31oj2axurgpjyz vhost]# cat www.conf 
server
    {
    listen 443 ssl;
    server_name xxx;
    ssl_certificate   /usr/local/nginx/conf/cert/3641582xxx.pem;
    ssl_certificate_key  /usr/local/nginx/conf/cert/3641582xxx.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  /xxxx;
    location / { 
   if (!-e $request_filename) {
      rewrite  ^(.*)$  /index.php?s=/$1  last;
      break;
    }
    }
        #error_page   404   /404.html;
        include enable-php.conf;
        location /nginx_status
        {
            stub_status off;
            access_log   off;
        }
}
server
    {
        listen 80 default;
        server_name xxxx;
#把http的域名请求转成https
#rewrite ^(.*)$ https://$host$1 permanent;

6.重载nginx配置文件

/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx -s reload

7.这里就完事了,如果是阿里云服务器的话 必须开放443端口 控制面板->云服务器ECS

10.png

11.png


请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!

该博客于2020-12-7日,后端基于go语言的beego框架开发
前端页面使用Bootstrap可视化布局系统自动生成

是我仿的原来我的TP5框架写的博客,比较粗糙,底下是入口
侯体宗的博客

      订阅博客周刊

文章标签

友情链接

HouTiZong
侯体宗的博客
© 2020 zongscan.com
版权所有ICP证 : 粤ICP备20027696号
PHP交流群
侯体宗的博客