Step1:安装snapd【linux包管理工具】
sudo apt install snapd     #安装snapd
sudo snap install core		 #安装core
sudo snap refresh core		 #刷新core
 
Step2::安装certbot【一个开源免费的工具,为网站自动安装基于Let’s Encrypt服务的SSL证书】
sudo snap install --classic certbot   #安装certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot #创建链接以确保certbot的正确运行
 
Step3:创建SSL证书【使用certbot创建ssl证书】
- 方式一:为所有域创建 SSL 证书并在 Web 服务器中配置重定向(推荐这种)
 
sudo certbot --nginx  #nginx安装ssl证书
sudo certbot --apache  #apache安装ssl证书
 
- 方式二:为指定域创建 SSL 证书
 
sudo certbot --nginx -d example.com -d www.example.com
sudo certbot --apache -d example.com -d www.example.com
 
- 方式三:仅安装 SSL 证书
 
sudo certbot certonly --nginx
sudo certbot certonly --apache
 
接着按照指示选择即可
 
 
访问自己的网站,显示安全即成功!!!
 o( ̄▽ ̄)d
参考文章:ssl-ubuntu-with-certbot










