【问题标题】:Enable https (certbot) with new domain, apache使用新域 apache 启用 https (certbot)
【发布时间】:2020-04-04 17:29:36
【问题描述】:

我添加了一个域。

想要使用 certbot 为新域启用 https。

关注这个https://certbot.eff.org/lets-encrypt/ubuntubionic-apache

sudo certbot --apache
[sudo] password for qq: 
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: old.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 

我只能看到我的旧域。我通过新域有 ssh。

如何添加新域?

【问题讨论】:

  • 您是否有新的主机解析器并在 apache 中进行了配置?
  • @RomeoNinov 我不知道。这个设置在哪里?
  • 你的主机操作系统是什么,你如何安装apache?你是怎么配置的?
  • Ubuntu。我使用了 apt-get。

标签: apache https certbot


【解决方案1】:

我的猜测是您忘记在 Apache 配置中添加域。尝试通过 /etc/apache2/sites-available 查看您的配置。

如果您的新域名已经配置,请尝试通过检查配置文件是否链接到/etc/apache2/sites-enabled 来查看它是否已启用。如果是,请尝试重新加载 apache2 以确保加载最新的配置

sudo systemctl reload apache2

或者如果配置不存在,请尝试启用它们

sudo a2ensite my-new-config
sudo systemctl reload apache2

如果新域仍未显示,您可以尝试手动生成证书,然后在配置中手动使用它:

sudo certbot certonly -d new-domain.com -d www.new-domain.com

【讨论】:

  • 在哪里指定新域?站点下有 3 个文件可用。是 000-default.conf。在这个文件中,我有 RewriteCond %{SERVER_NAME} =old.example.com
  • @Joe 您可以在虚拟主机httpd.apache.org/docs/2.4/vhosts/name-based.html 内设置ServerName 和(如果需要)ServerAlias
  • 是的。我在 ServerName 下有旧域。但它被注释掉了(#ServerName)?
  • 您需要设置ServerName。如果您想同时启用旧的和新的,那么您可以在ServerName 中拥有正确的一个,在ServerAlias 中拥有另一个,即ServerName www.new-domain.com ServerAlias new-comain.com old-domain.com www.old-domain.comServerNameServerAlias 在每个自己的换行符 - cmets 中显然没有显示换行符)
猜你喜欢
  • 2019-05-29
  • 2021-03-02
  • 1970-01-01
  • 2017-07-24
  • 2020-09-13
  • 2020-08-24
  • 2019-09-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多