网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

在你的网站服务器配置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),让你的网站更安全。

成都创新互联公司从2013年成立,是专业互联网技术服务公司,拥有项目成都做网站、网站制作、成都外贸网站建设网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元荔浦做网站,已为上家服务,为荔浦各地企业和个人服务,联系电话:18980820575

 

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


 


当前文章:在你的网站服务器配置https
路径分享:http://bjjierui.cn/article/ieopsd.html

其他资讯