apache - 修复,让 Let's Encrypt 与 www 一起使用
问题描述
Firefox 不信任此站点,因为它使用的证书对www.example.com无效。证书仅对 example.com 有效。
错误代码:SSL_ERROR_BAD_CERT_DOMAIN
我在 Ubuntu 16、Apache httpd 上使用 Let's Encrypt。
如何添加它也适用于www?我猜是Apache中的一些conf?
找不到任何关于它的东西。
解决方案
假设您已安装certbot
(适用于您的 Ubuntu 和 Apache 版本的文档),您应该使用-d
命令行开关列出您希望证书适用的域。 从文档:
-d DOMAIN, --domains DOMAIN, --domain DOMAIN Domain names to apply. For multiple domains you can use multiple -d flags or enter a comma separated list of domains as a parameter. The first domain provided will be the subject CN of the certificate, and all domains will be Subject Alternative Names on the certificate. The first domain will also be used in ...
如果您想进行试运行以进行测试,请使用certonly
and --dry-run
(您必须使用 asroot
或 with运行sudo
):
certbot certonly --dry-run -d www.example.com -d example.com
如果看起来一切正常,实际生成、安装和激活证书(注意这将重新启动 Apache):
certbot --apache -d www.example.com -d example.com
certbot
将为您对 Apache 配置进行必要的编辑。
如果您希望手动进行编辑,请使用该webroot
选项。 该选项的文档包括对多个域执行此操作的示例,包括 example.com 和www.example.com。从该示例中删除其他域以简化这种情况:
certbot certonly --webroot -w /var/www/example -d www.example.com -d example.com
使用此选项时,您需要自己重新启动 Apache 才能使用新证书。
推荐阅读
- r - 如何创建名称在字符向量中指定的新列
- amazon-web-services - 创建阶段时存储集成不允许 S3 位置
- java - 通过套接字发送消息时出现问题
- algorithm - Root 方法在 Quick-Union 中如何工作?
- github - 我忘了'git push'
- arrays - 满 BUFFER 容量的循环队列
- c# - 显示 RabbitMQ 消息而不使用它们
- pgadmin-4 - 在mac上首次安装PG Admin 4错误
- python - Bert 使用 Transformer 的管道和 encode_plus 函数
- python - GroupBy 一个数据框记录并使用 PySpark 显示所有列