在CentOS6,CentOS7安装 Let'sEncrypt 免费SSL安全证书

本文详细介绍了如何在CentOS6和CentOS7上使用CertBot安装Let'sEncrypt免费SSL证书,包括系统升级、EPEL库安装、证书获取、防火墙配置、Apache配置以及证书续订等步骤。

相对来说,个人网站建立SSL是昂贵的,而且往往过程繁琐。一个标准的2048位证书费用至少150美元/年,网站除了要支付一笔昂贵的费用、重新配置Web服务器,并需要解决大量的配置错误。这让广大中小网站望而生畏。

然而,Let's Encrypt免费证书的开放,极大推进了国内 HTTPS 的进程。Let's Encrypt 真正的意义在于,它推动了 HTTPS 在小型网站和个人网站中的应用,加速全面 HTTPS 时代的到来。Let's Encrypt 的最大贡献是它的 ACME 协议,第一份全自动服务器身份验证协议,以及配套的基础设施和客户端。这是为了解决一直以来 HTTPS TLS X.509 PKI 信任模型,即证书权威(Certificate Authority, CA)模型缺陷的一个起步。

Let'sEncrypt的工作原理

看图:

Let'sEncrypt工作原理图

ACME 解决了私钥持有者验证自己身份这一过程的自动化问题。

在CentOS6,CentOS7上安装Let's Encrypt

非营利组织电子前沿基金会的CertBot是一个很好的工具,我们使用它来安装Let's Encrypt

一、升级系统

  1. # yum -y update

二、安装EPEL库,为CertBot提供最新的Python包。

  1. # yum -y install epel-release

三、下载CertBot

1、CentOS7:

  1. # yum -y install python-certbot-apache

2、CentOS6:

  1. # wget https://dl.eff.org/certbot-auto
  2. # chmod 755 certbot-auto

四、Apache下配置Let's Encrypt

执行下条命令

  1. # ./certbot-auto --apache

根据提示操作

  1. /root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6
  2. DeprecationWarning
  3. Saving debug log to /var/log/letsencrypt/letsencrypt.log
  4. Enter email address (used for urgent renewal and security notices) (Enter 'c' to
  5. cancel):输入管理员邮箱
  6.  
  7. -------------------------------------------------------------------------------
  8. Please read the Terms of Service at
  9. https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf. You must agree
  10. in order to register with the ACME server at
  11. https://acme-v01.api.letsencrypt.org/directory
  12. -------------------------------------------------------------------------------
  13. (A)gree/(C)ancel: A
  14.  
  15. -------------------------------------------------------------------------------
  16. Would you be willing to share your email address with the Electronic Frontier
  17. Foundation, a founding partner of the Let's Encrypt project and the non-profit
  18. organization that develops Certbot? We'd like to send you email about EFF and
  19. our work to encrypt the web, protect its users and defend digital rights.
  20. -------------------------------------------------------------------------------
  21. (Y)es/(N)o: Y
  22.  
  23. Which names would you like to activate HTTPS for?
  24. -------------------------------------------------------------------------------
  25. 1: www.xi-chuang.com
  26. -------------------------------------------------------------------------------
  27. Select the appropriate numbers separated by commas and/or spaces, or leave input
  28. blank to select all options shown (Enter 'c' to cancel):1
  29. Obtaining a new certificate

成功后,在/etc/letsencrypt/live/www.xi-chuang.com/下生成4个证书:

  1. cert.pem ->
  2. chain.pem ->
  3. fullchain.pem ->
  4. privkey.pem ->

五、打开防火墙iptables的443端口

  1. -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
  2. #service iptables restart

六、编辑ssl.conf

vi /etc/httpd/conf.d/ssl.conf

  1. # General setup for the virtual host, inherited from global configuration
  2. DocumentRoot "/var/www/html/xi-chuang.com"
  3. ServerName www.xi-chuang.com:443
  4. .
  5. .
  6. .
  7. SSLCertificateFile /etc/letsencrypt/live/www.xi-chuang.com/fullchain.pem
  8. .
  9. .
  10. .
  11. SSLCertificateKeyFile /etc/letsencrypt/live/www.xi-chuang.com/privkey.pem
  12. .
  13. .
  14. .

service httpd restart

七、这个时候网站HTTPS已经能够访问了,试一下

最后,通过.htaccess进行301转向

  1. RewriteEngine On
  2. RewriteCond %{SERVER_PORT} 80
  3. RewriteRule ^(.*)$ https://www.xi-chuang.com/$1 [R=301,L]
  4. RewriteCond %{HTTP_HOST} !^www.xi-chuang.com$ [NC]
  5. RewriteRule ^(.*)$ https://www.xi-chuang.com/$1 [L,R=301]

八、大功告成

注意:Let'sEncrypt的证书有效期为90天,因此,建议使用cron作业在证书到期前一周将证书renew

转载于:https://www.cnblogs.com/suiyuewuxin/p/7095743.html

本研究聚焦于地级以上城市,对资本、劳动力的空间错配程度进行了系统测度。借助时空核密度和综合协调指数,对城市资源空间错配的集聚模式及协调度展开细致分析,以期揭示城市资源空间错配在时空演变过程中的内在规律。不同资源类型的城市空间错配程度在样本期内呈现出明显差异。城市资本和劳动力的空间错配,未能在不同地区、行业或企业之间实现最优配置,导致资源的边际产出不相等,从而偏离帕累托最优状态,造成效率损失和经济结构失衡。在地级市层面,资源错配问题尤为突出,主要表现为资本、劳动力和土地要素在城市间的配置不均衡。本数据包含原始数据、参考文献、代码、最终结果。原始数据资料:分城市财政收支083045349(仅供vip使用)分城市固定资产投资与消费075134218(仅供vip使用)分城市国内生产总值150425289(仅供vip使用)分城市金融统计文件083120235(到2023年)分城市人口、就业与工资150748455(仅供vip使用)分省份按城乡分全社会国定资产投资075038121(仅供vip使用)分省份固定资产投资价格指数075341115(仅到2019年)分省份国内生产总值150256154(仅供vip使用)分省份人口情况文件152110158(仅供vip使用)指数基本信息文件083840325(仅供vip使用)1998-2023固定资产投资价格指数.xlsxfinancial_data_analysis_report_wsl 20250903_205457.xlsxfinancial data_analysis_report_ wsl 20250903 205457_charts.pngn1.各地区进出口总额年度统计文件(按企业注册类型分).csv樊纲1997-2019年市场化指数和各分项指数.xlsx樊纲1997-2023年市场化指数和各分项指数.xlsx分省份财政金融文件(1995-2023).csv分省份外商投资企业年底注册登记情况.csv复现说明.docx固定资产投资资金来源-年度(分省级).xlsx极速下载 各省资本存量数据2000-2023年(原始数据+测算+结果...相关数据及指标省 地级市 年份 资本错配指数 劳动力错配指数
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值