Skip to content
Menu
小小述博客
  • 首页
  • Nginx
  • Php
  • Laravel
  • Git
  • 在线工具
  • 资源下载
  • Magento2
小小述博客
2019年9月19日2019年10月12日

lamp 配置ssl-certbot 案例

Post Views: 660

系统是Ubuntu14.04 lamp环境

配置命令地址:

通过ssh 登录服务器

工具软件:putty

安装Certbot

在服务器上运行下面命令,执行安装Certbot

$ wget https://dl.eff.org/certbot-auto
$ sudo mv certbot-auto /usr/local/bin/certbot-auto
$ sudo chown root /usr/local/bin/certbot-auto
$ sudo chmod 0755 /usr/local/bin/certbot-auto

选择运行Certbot的方式,获取并安装证书

自动安装SSL

运行此命令以获取证书并让Certbot自动编辑Apache配置以便为其提供服务,只需一步即可启用HTTPS访问,

命令如下:

sudo /usr/local/bin/certbot-auto --apache

系统自动列举出域名,选择你要配置SSL的域名的编号,以及设置是否强制跳转到ssl(输入数字 1 不跳转),下面是安装过程、

sunyang@127:/etc/apache2/sites-available$ sudo /usr/local/bin/certbot-auto --apache
/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/cryptography/hazmat/primitives/constant_time.py:26: CryptographyDeprecationWarning: Support for your Python version is deprecated. The next version of cryptography will remove support. Please upgrade to a release (2.7.7+) that supports hmac.compare_digest as soon as possible.
  utils.PersistentlyDeprecated2018,
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: lollicupcd.com
2: a.lollicupcd.com
3: barry.lollicupcd.com
4: bill.lollicupcd.com
5: mgt1938.lollicupcd.com
6: www.lollicupcd.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 3
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for barry.lollicupcd.com
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/barry_lollicupstore-le-ssl.conf
Deploying Certificate to VirtualHost /etc/apache2/sites-available/barry_lollicupstore-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/barry_lollicupstore-le-ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1
Future versions of Certbot will automatically configure the webserver so that all requests redirect to secure HTTPS access. You can control this behavior and disable this warning with the --redirect and --no-redirect flags.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://barry.lollicupcd.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=barry.lollicupcd.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/barry.lollicupcd.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/barry.lollicupcd.com/privkey.pem
   Your cert will expire on 2020-01-10. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot-auto
   again with the "certonly" option. To non-interactively renew *all*
   of your certificates, run "certbot-auto renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

然后在浏览器执行 : https://www.ssllabs.com/ssltest/analyze.html?d=mgt1938.lollicupcd.com&latest

系统获取证书,自己手动配置

只需获得证书 ,如果您感觉更加保守并希望手动更改Apache配置,请运行此命令。

$ sudo /usr/local/bin/certbot-auto certonly --apache

设置自动续订 SSL

$ echo "0 0,12 * * * root python -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/local/bin/certbot-auto renew" | sudo tee -a /etc/crontab > /dev/null

本文参考: https://certbot.eff.org/lets-encrypt/ubuntuother-apache

发表回复

要发表评论,您必须先登录。

504 API Bootstrap基础 Composer 基础 Docker elasticsearch facebook Git 基础 Google Go 入门 IntegerNet_Solr jdk Jquery Laravel Laravel-admin Laravel 入门到精通教程 Laravel 基础 Linux Cron Linux sudo linux命令 Linux权限 Linux 用户和组 Linux 解压 Lnmp Magento2 主题 Magento2 事件 Magento2 功能 Magento2 命令 Magento2 安装 Magento2 数据库 Magento2 模块 Mamp Paypal php Phpstorm PHP优化 PHP函数 Php面试题 Robots solr Sourcetree SSH SSL Wordpress 阿里云服务器

  • linux 系统查看所有用户的crontab定时任务2023年1月5日
  • Mgento 2 缓存文件用户组权限不对2023年1月5日
  • Magento 2 中怎么禁用事件观察器2022年12月30日
  • Elasticsearch 安装与卸载2022年12月2日
  • Magento 2.4 Content security policies 内容安全策略2022年11月2日
  • Magento 2.4 Disable Page Builder2022年11月1日
  • phpMyAdmin无法缓存模板文件,所以会运行缓慢2022年10月29日
  • PhpMyAdmin配置文件现在需要一个短语密码2022年10月29日
  • Mamp xxx column name table_namePlease run mysql_upgrade2022年10月29日
  • 如何在 PHPMYADMIN 中将表数据显示设置为最大5002022年10月26日
  • 开源工厂
  • 码农网
  • 前端学习
  • Get社区学习
  • Guru99 学习
  • tecadmin.net
  • 深入理解PHP内核
  • 国际IT专场
  • 51CTO
  • https://bbs.mallol.cn
  • http://techjeffyu.com/
  • https://webkul.com/
  • qastack
  • Innfoq
  • 刘祥博客
  • 阿里云
  • DigitalOcean
  • 华为云服务器
  • 华为云开发者中心
  • 华为云服务器文档
  • 阿里云服务器文档
  • Linux命令大全(手册)
  • WEB技术分享
  • 博学无忧博客
  • Ostechnix
  • Linux公社
  • LinuxHomene
  • Linux 服务器操作
  • Linux 就该这么学
  • Linux 从入门到精通
  • Linux 中国开源社区
  • Linux命令大全(手册)
  • Ubuntu Apache 命令学习
  • CSDN
  • 菜鸟学习教程
  • 鸟哥的Linux 私房菜
  • w3school教程
  • Bootstrap 中文网
  • Yii 中文网
  • Yii中文框架
  • 程序员的在线工具
  • 运维教程
  • 梦康的博客
  • 考评师
  • 社交分享教程
  • GitHub
  • 后端进阶
  • 端隐SDP 零信任安全
  • 示说网
  • 脚本之家
  • 开源资源
  • 蓝文资源库
  • Ubuntu 官网
  • linuxize.com
  • Linux Help
  • tecmint
  • 脚本之家在线工具
  • php1中文社区
  • 云知梦
  • IT之家
  • https://www.geeksforgeeks.org/
  • https://laravel-school.com/
  • https://laravelacademy.org/
  • https://zditect.com/guide/
  • https://www.studytonight.com/
  • https://dev.to/
  • https://dev.to/listings
  • https://dev.to/saifullah/8-free-websites-to-learn-coding-3c5
  • https://www.rakeshjesadiya.com/
  • magento-2-video-tutorials

©2023 小小述博客 | Powered by WordPress and Superb Themes!