完成 WordPress 安装后,WordPress 网站与用户之间的通信是通过 HTTP(未加密)完成的。虽然 HTTP 可用于测试目的,但要在生产环境中使用,就必须切换到HTTPS。
sudo apt-get install certbot python3-certbot-nginx -y
sudo certbot --nginx -d www.example.com
获取成功后,可选择让 Nginx 自动配置 HTTP 重定向 HTTPS。
sudo certbot certonly --manual -d *.example.com -d example.com --agree-tos --email you@example.com --no-bootstrap --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory
获取成功后,证书将会存储在 /etc/letsencrypt
目录下。接下来先在 WordPress 设置界面更改网址为 HTTPS,再重启 Nginx,此时再进入就会自动跳转到 HTTPS。
*请注意,获取的 Letsencrypt 免费证书有效期为3个月。
发表评论须遵守中华人民共和国相关法律法规。违规评论将会被删除。
Comments must subject to the relevant laws and regulations of the People’s Republic of China. Offending comments will be deleted.
WordPress是目前流行的开源内容管理系统(C…
WordPress是目前流行的开源内容管理系统(C…