使用 LetsEncrypt certbot 在 Ubuntu 上为子域启用 HTTPS

问题描述 投票:0回答:1

我运行命令

sudo certbot certonly -d example.com -d www.example.com - sub.example.com
并收到以下错误:

Certbot failed to authenticate some domains (authenticator: apache). The Certificate Authority reported these problems:
  Domain: sub.example.com
  Type:   unauthorized
  Detail: 12.34.56.78: Invalid response from https://www.example.com: "\r\n<!DOCTYPE html>\r\n\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\">\r\n<head>\r\n"

之前已为根域和“www”配置了 SSL,但我正在尝试添加其他子域。所有域名都可以通过浏览器访问,但 sub.domain.com 是唯一一个表示不安全的域名。

/atc/apache2/sites-availabel/default-ssl.conf 看起来像这样:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Include /etc/letsencrypt/options-ssl-apache.conf
    ServerAlias www.example.com, sub.example.com
    SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>
</IfModule>

我在这里错过了什么还是我应该做点别的事情?

ubuntu ssl https certbot
1个回答
0
投票

添加别名后忘记重启apache

© www.soinside.com 2019 - 2024. All rights reserved.