以前写过利用 wordpress 搭建的一个博客『个人博客搭建( wordpress )』,绑定了域名,但是没开启 https,在浏览博客的时候浏览器会提示不安全。下面来谈下个人博客如何免费申请证书,开启 https 。

一、申请 Let's Encrypt 证书

系统环境要求:python2.7+

手动申请网址:letsencrypt.osfipin.com/v2/login

1、安装 git

yum install -y git
查看版本号:git --version
卸载:yum remove git

2、安装 letsencrypt

git clone https://github.com/letsencrypt/letsencrypt

3、生成证书

在 letsencrypt 目录下执行

./letsencrypt-auto certonly --standalone --email YOUR_EMAIL -d xxx.com --quiet --agree-tos

4、错误处理

rm -rf  ~/.pip/pip.conf

PS: no response "Installing Python packages"

# vim ~/.pip/pip.conf or vim ~/.config/pip/pip.conf
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple/ [install]
trusted-host=pypi.tuna.tsinghua.edu.cn

二、配置 nginx

# vim /etc/nginx/nginx.conf
...
http {
...
server {
listen 80;
server_name xxx.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name xxx.com;
server_name_in_redirect off;
ssl_certificate "/etc/letsencrypt/live/hirat.online/fullchain.pem";
ssl_certificate_key "/etc/letsencrypt/live/hirat.online/privkey.pem";
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REQUEST-URI $request_uri;
proxy_set_header Cookie $http_cookie;
proxy_pass http://localhost:9090;
proxy_cookie_domain domino.server nginx.server;
proxy_redirect off;
}
}
}

三、启动 nginx

systemctl start nginx.service

浏览器输入:https://xxx.com 看看效果。

特别提醒:上面的方法申请的 Let's Encrypt 免费证书有效期90天的,别忘了续签。
												

个人博客如何开启 https的更多相关文章

  1. 利用GitHub搭建Hexo博客并开启HTTPS

    Hexo 是一个快速.简洁且高效的博客框架.Hexo 使用 Markdown(或其他渲染引擎)解析文章,在几秒内,即可利用靓丽的主题生成静态网页. GitHub 是一个面向开源及私有软件项目的托管平台 ...

  2. 我的博客搬家到https://www.w2le.com/了

    大家以后想看我的博文的请到这里哦,欢迎大家访问https://www.w2le.com/

  3. 使用halo搭建自己的博客并配置https域名访问

    首先进行java配置 # 1. 下载jdk [下载地址](https://www.oracle.com/cn/java/technologies/javase-downloads.html) - 一定 ...

  4. 在GitHub搭建个人博客 地址: https://douzujun.github.io/

    搭建博客地址:https://douzujun.github.io/ 博客模板:https://github.com/douzujun/douzujun.github.io 显示效果:

  5. 使用Coding.net+Hexo+node.js+git来搭建个人博客

    使用Coding.net来搭建基于Hexo的博客 一.准备工作 什么是Coding.net Coding可以说,就是国产的Github,但是,有一个功能使它似乎超越了GitHub-那就是 Web ID ...

  6. Git+Hexo搭建个人博客详细过程

    通过Git+Hexo搭建的个人博客地址:https://liangh.top/ 1.安装Node.js.配置好Node.js环境.安装Git和配置好Git环境,打开cmd命令行,成功界面如下 2.安装 ...

  7. github+hexo搭建博客

    引言     之前用阿里云弹性web托管采用wordpress搭建的个人博客,经过我使用一段时间之后发现存在很多问题: 网站的响应速度非常慢,估计打开主页需要3-4s的时间,我经过搜索发现很多人都有这 ...

  8. Hexo+Github: 博客网站搭建完全教程(看这篇就够了)

    本篇教程首次发布在个人博客:sunhwee.com,想要获得最佳阅读体验,欢迎前往,建议用电脑查看教程文档. # 阅读须知 注意,这篇文章篇幅较长,主要针对新手,每一步很详细,所以可能会显得比较啰嗦, ...

  9. 码云上部署hexo博客框架

    title: 码云上部署hexo博客框架 Hexo框架在码云上实现个人博客 本文受 https://www.jianshu.com/p/84ae2ba1c133 启发编写 本地调试 安装完Node.j ...

随机推荐

  1. HTML5☞canvas

    <canvas>便签用于绘制图像,图表.不过,<canvas> 元素本身并没有绘制能力(它仅仅是图形的容器) - 您必须使用脚本JavaScript来完成实际的绘图任务.既然你 ...

  2. nginx实现基础web

    目录 nginx实现基础web 什么是lnmp lnmp架构如何工作 Nginx与Fast-CGO详细工作流程 LNMP环境准备 一,部署LNMP 1.使用nginx官方源 2.创建nginx用户 3 ...

  3. python中基本数据类型以及运算符

    python中基本数据类型以及运算符的知识 一.与用户的交互以及python2与python的区别 1.1什么是与用户交互 用户交互就是人往计算机中input(输入数据),计算机print(输出结果) ...

  4. Django2.1 更新说明!

    Django2.1版本发布时间:2018-8-1 一.Python兼容性 Django2.1只支持Python 3.5. 3.6和3.7以上版本.Django2.0是最后一个支持Python3.4及一 ...

  5. Flask报如下错误:SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True or False to suppress this warning.

    在同一个项目中由于flask_sqlalchemy版本不同,有时会报如下错误 错误信息如下: flask_sqlalchemy\__init__.py:: UserWarning: SQLALCHEM ...

  6. 工作日志,证书无效 unable to find valid certification path to requested target

    工作日志,证书无效 unable to find valid certification path to requested target 最近被这个问题弄得头大.导致所有用到 se.transmod ...

  7. 高通lk屏幕向kernel传参

    LK把相关参数报存到cmdline上: 在Bootable\bootloader\lk\dev\gcdb\display\gcdb_display_param.c上gcdb_display_cmdli ...

  8. linux内核的冷热页分配器

    先说说cpu的cache,和cpu的cache比起来访问主内存是非常慢的,为了加快速度根据本地性原则,cpu在访问主内存的时候会把附近的一块数据都加载到cpu的cache里,之后读写这块数据都是在ca ...

  9. HTML标记一览表

  10. 关于OpenCASCADE数组序列的起始值

    C/C++的数组是从0开始计算的,5个值的数组则下标会对应 0, 1, 2, 3, 4. 在数学上可能不这么数,我所知道的 Mathematica 内的 List 是从 1 开始作为下标的. Open ...