https(全称:Hyper Text Transfer Protocol over Secure Socket Layer),是以安全为目标的 http 通道,简单讲是 http 的安全版。即 http 下加入 SSL 层,https 的安全基础是 SSL,因此加密的详细内容就需要 SSL。
LAMP 新增对 Let’s Encrypt 的支持,自动签发免费的证书,并添加自动任务到 crond,定期运行自动更新证书。
安装完 LAMP 后,lamp 命令就可以使用了,用法如下。

Usage: lamp [ add | del | list ]
add     Create new Apache Virtual Host
del     Delete Apache Virtual Host
list    List all of Apache Virtual Host

 

下面为使用 lamp 命令增加 SSL 证书支持的详细使用教程。

新增虚拟主机
注意:在新增虚拟主机之前,请务必确保域名已经解析到该服务器(VPS)的 IP 上,否则 Let’s Encrypt 验证无法通过。
使用命令:

lamp add

交互显示如下:

Please enter server names(example: www.lamp.sh lamp.sh): 此处输入网站域名
Please enter website root directory(default:/data/www/网站域名): 此处输入网站根目录路径,默认回车即可
Please enter Administrator Email address: 此处输入管理员邮箱地址
Administrator Email address: 此处显示上一步输入的邮箱地址
Do you want to create a database and mysql user with same name? [y/n]: 此处输入 y 或 n,表示创建或不创建数据库(输入 y)
Virtual host [网站域名] has been created
Website root directory is: /data/www/网站域名
Database [数据库名] and mysql user [数据库用户名] has been created // 数据库及同名用户创建成功
Reloading the apache config file...
Syntax OK
Reload success
Do you want to add a SSL certificate? [y/n]: 此处输入 y 或 n,表示添加或不添加证书(输入 y)
1: Use your own SSL Certificate and Key
2: Use Let's Encrypt to create SSL Certificate and Key
Please enter 1 or 2: 此处输入 1 或 2,表示使用自己的证书,或使用 Let's Encrypt 签发免费证书(输入 2)
You have already chosen Let's Encrypt
It will be processed automatically
Installing certbot command...
此处开始下载安装 certbot 命令
Starting create Let's Encrypt SSL Certificate...
此处开始安装 certbot 运行所需的依赖库等
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for 网站域名
Using the webroot path /data/www/网站域名 for all unmatched domains.
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:- Congratulations! Your certificate and chain have been saved at:/etc/letsencrypt/live/网站域名/fullchain.pemYour key file has been saved at:/etc/letsencrypt/live/网站域名/privkey.pemYour cert will expire on 2018-02-02. To obtain a new or tweakedversion of this certificate in the future, simply run certbotagain. To non-interactively renew *all* of your certificates, run"certbot renew"- Your account credentials have been saved in your Certbotconfiguration directory at /etc/letsencrypt. You should make asecure backup of this folder now. This configuration directory willalso contain certificates and private keys obtained by Certbot somaking regular backups of this folder is ideal.- If you like Certbot, please consider supporting our work by:Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donateDonating to EFF:                    https://eff.org/donate-leLet's encrypt crontab renew rule is not exist, create it!
Create Let's Encrypt SSL Certificate successfully
Reloading the apache config file...
Syntax OK
Reload success
All done

 

结束后,查看 crond 任务,命令如下:

crontab -l

确认返回值里包含以下语句:

0 3 */7 * * /bin/certbot renew --disable-hook-validation --renew-hook "/etc/init.d/httpd restart"

Let’s Encrypt 签发的证书和私钥路径:

/etc/letsencrypt/live/网站域名/fullchain.pem
/etc/letsencrypt/live/网站域名/privkey.pem

创建完虚拟主机后,网站的根目录为:

/data/www/网站域名

日志文件的目录为:

/data/wwwlog/网站域名

最后,别忘了将你的程序放到网站根目录下,即可使用。
祝使用愉快!

转载于:https://www.cnblogs.com/SofuBlue/p/8304931.html

免费证书https://lamp.sh/ssl.html相关推荐

  1. 如何申请免费证书(HTTPS)

    如果你的网站域名下, 需要https的证书访问, 需要申请, 可以采用自签名证书, 也可以到FreeSSL首页 - FreeSSL.cn一个提供免费HTTPS证书申请的网站来申请. 首先: 你需要注册 ...

  2. android webview单向认证,android 让webview支持自签名证书https 双向认证(SSL)

    最近完成一个项目,安全级别比较高.所以涉及到https双向认证,在网上找了很多资料都没有完美的解决方案.最后参考了org.sandrob.sslexample的实现方式,结合实际情况才完成该技术难题, ...

  3. 运维(17) OHTTPS配置免费证书及宝塔网站管理配置

    文章目录 一.前言 二.OHTTPS配置免费证书 1.创建证书 2.域名解析配置 3.验证解析记录 4.查看证书 三.宝塔网站管理配置 1.添加站点 2.配置SSL 3.访问网站测试 4.其它 一.前 ...

  4. acme.sh从 letsencrypt 生成SSL免费证书并自动更新证书

    acme.sh 实现了 acme 协议, 可以从 letsencrypt 生成免费的证书 ACME 协议: Automatic Certificate Management Environment 自 ...

  5. 微信小程序免费SSL证书https、TLS版本问题的解决方案

    微信小程序与第三方服务器通讯的域名5个必要条件 1.一个已备案的域名,不是localhost.也不是127.0.0.1,域名不能加端口 2.加ssl证书,也就是https://~~~ 4.HTTPS ...

  6. Java Web学习总结(31)——全站HTTPS化SSL免费证书使用

    1 背景 谷歌从 2017 年起,Chrome 浏览器将也会把采用 HTTP 协议的网站标记为「不安全」网站:苹果从 2017 年 iOS App 将强制使用 HTTPS:在国内热火朝天的小程序也要求 ...

  7. cloudflare免费证书_新Cloudflare:免费CDN+免费SSL证书轻松搞定https

    Cloudflare是一个非常优秀的CDN服务商,在Cloudflare刚刚推出时就已经试用过他们的服务了,后来由于Cloudflare国内用户的增多,导致了Cloudflare CDN服务器IP无法 ...

  8. 免费的HTTPS(白嫖阿里云SSL证书)

    带着问题看内容 如何配置 HTTPS? 免费的HTTPS? 介绍 之前本来是用的 certbot,不知道为啥突然出问题了. 然后之前也了解过阿里云上也有免费的 SSL 证书,自己的域名也 是阿里云管理 ...

  9. 八大免费SSL证书-给你的网站免费添加Https安全加密

    SSL证书,用于加密HTTP协议,也就是HTTPS.随着淘宝.百度等网站纷纷实现全站Https加密访问,搜索引擎对于Https更加友好,加上互联网上越来越多的人重视隐私安全,站长们给网站添加SSL证书 ...

最新文章

  1. 下属能力很强,却犯了错误,该如何处理?处理不好会出问题
  2. 8086汇编复习3 - 标志寄存器 - 使用emu8086
  3. 编写递归下降语法分析器_Python3知识点流程控制、迭代器、生成器快速入门
  4. 【蓝桥杯】基础练习 数列排序
  5. 只读副本和Spring Data第3部分:配置两个实体管理器
  6. shell字段拼接日期_shell 脚本字符串拼接
  7. 结构体含有指针的写入文件
  8. Verilog代码实例化的简单理解(以38译码器为例)
  9. 牛客多校第三场J LRU management(双向链表)题解
  10. Java 编程需要注意的细节
  11. cmd 复制文件命令copy 复制目录树命令xcopy
  12. 时间 java 时间段_Java 如何判断当前时间是否在指定时间段内
  13. Python名词解释
  14. win10小课堂:微信电脑端多开方法
  15. HTML旅游网站设计与实现——东江湖旅游网站6个网页HTML+CSS+JavaScript
  16. 【3分钟秒懂】MCU启动流程详解 基于NXP MPC574xG
  17. 国密SM1、SM2、SM3、SM4算法资料大全
  18. 概率论与数理统计_陈希儒版_第一章:事件的概率
  19. 如何清除搜狗输入法自带的“搜狐新闻”?
  20. realme闪充技术令外媒惊叹,国产手机靠创新打破苹果垄断

热门文章

  1. osg多线程_尝试使用Osg编译上下文实现多线程编译显示列表--总结
  2. 网络通信 public ip 和 private ip
  3. pandas 增删改
  4. MySQL Window Function Descriptions
  5. 2.8 GloVe 词向量
  6. Linux 安装Eclipse
  7. sip 时序图_Tcl与Design Compiler (五)——综合库(时序库)和DC的设计对象(下)
  8. 专有网络 VPC > VPC与外部网络连接 > 连接VPC
  9. 华为-公有云-云硬盘-磁盘类型及性能介绍
  10. 项目管理学习总结(4)——项目团队,如何展开有效沟通?