资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

在你的网站服务器配置https-创新互联

在你的网站服务器配置https

简介

通过Let's Encrypt免费提供的证书服务,实现http使用ssl进行加密传输(https://zh.wikipedia.org/wiki/%E5%82%B3%E8%BC%B8%E5%B1%A4%E5%AE%89%E5%85%A8%E5%8D%94%E8%AD%B0),让你的网站更安全。

10年专注成都网站制作,成都定制网站,个人网站制作服务,为大家分享网站制作知识、方案,网站设计流程、步骤,成功服务上千家企业。为您提供网站建设,网站制作,网页设计及定制高端网站建设服务,专注于成都定制网站,高端网页制作,对成都塑料袋等多个方面,拥有多年的网站营销经验。

Let's Encrypt

Let's Encrypt作为一个公共且免费SSL的项目逐渐被广大用户传播和使用,是由Mozilla、Cisco、Akamai、IdenTrust、EFF等组织人员发起,主要的目的也是为了推进网站从HTTP向HTTPS过度的进程,目前已经有越来越多的商家加入和赞助支持。

Let's Encrypt免费SSL证书的出现,也会对传统提供付费SSL证书服务的商家有不小的打击。到目前为止,Let's Encrypt获得IdenTrust交叉签名,这就是说可以应用且支持包括FireFox、Chrome在内的主流浏览器的兼容和支持,虽然目前是公测阶段,但是也有不少的用户在自有网站项目中正式使用起来。

操作环境如下

[root@www ~]# cat /etc/redhat-release

CentOS Linux release 7.2.1511 (Core)

[root@www ~]# nginx -V

nginx version: nginx/1.12.0

built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)

built with OpenSSL 1.0.1e-fips 11 Feb 2013

TLS SNI support enabled

configure arguments: --user=nginx --group=nginx --prefix=/application/nginx-1.12.0/ --with-http_v2_module --with-http_ssl_module --with-http_sub_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre

安装certbot

yum安装certbot:

启用EPEL仓库

[root@www ~]# yum install -y yum-utils

[root@www~] # yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

安装certbot

[root@www~] # sudo yum install certbot

git安装certbot:

安装git工具:

安装依赖:

[root@www ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel

下载源码:

[root@www ~]# wget https://github.com/git/git/archive/v2.13.0.tar.gz

编译安装git:

[root@www ~]# tar -zxf git-2.13.0.tar.gz

[root@www ~]# cd git-2.13.0

[root@www git-2.13.0]# make prefix=/usr/local all

[root@www git-2.13.0]# make prefix=/usr/local install

更新python至2.7以上:

检查python版本

[root@www git-2.13.0]# python -V

Python 2.4.3

安装gcc编译器

[root@www ~]# yum -y install gcc

下载python源码

[root@www ~]# wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz

编译安装python2.7

[root@www ~]# tar -zxf Python-2.7.13.tgz

[root@www ~]# cd Python-2.7.13

[root@www ~]#./configure

[root@www ~]# make all

[root@www ~]# make install

[root@www ~]# make clean

[root@www ~]# make distclean

更改python命令指向python2.7

[root@www Python-2.7.13]# mv /usr/bin/python /usr/bin/python2.4

[root@www Python-2.7.13]# ln -s /usr/local/bin/python2.7 /usr/bin/python

[root@www Python-2.7.13]# python -V

Python 2.7.13 #更新成功

安装certbot

[root@www ~]# git clone https://github.com/letsencrypt/letsencrypt

获取证书

使用手动的方式获取证书

yum安装certbot使用的命名

[root@www ~]# certbot certonly --standalone --email 244819336@qq.com -d czlun.top -d www.czlun.top

git安装certbot使用的命令

[root@www ~]# cd letsencrypt

[root@www letsencrypt]# ./letsencrypt-auto certonly --standalone --email 244819336@qq.com -d czlun.top -d www.czlun.top

244819336@qq.com替换成自己的邮箱

czlun.top与www.czlun.top替换成自己的域名

证书的位置

在对应的域名下有四个生成的密钥证书文件

[root@www ~]# ls /etc/letsencrypt/live/czlun.top/

cert.pem  chain.pem  fullchain.pem  privkey.pem  README

cert.pem - Apache服务器端证书

chain.pem - Apache根证书和中继证书

fullchain.pem - Nginx所需要ssl_certificate文件

privkey.pem - 安全证书KEY文件

配置nginx

server{

   listen 80;

   server_name czlun.top www.czlun.top;

   return 301 https://www.czlun.top$request_uri;

}

server {

   listen 443 ssl;

   server_name czlun.top www.czlun.top;

   ssl on;

       ssl_certificate /etc/letsencrypt/live/czlun.top/fullchain.pem;

       ssl_certificate_key /etc/letsencrypt/live/czlun.top/privkey.pem;

   [该域名主机的其他配置在这]

}

重启nginx可以看到SSL证书生效,且HTTPS可以访问站点

在你的网站服务器配置https

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


新闻名称:在你的网站服务器配置https-创新互联
当前网址:http://cdkjz.cn/article/eiccj.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220