使用Certbot获取SSL证书时遇到Unauthorized错误的求助
大家好,我最近在GoDaddy上入手了域名、主机和一台Ubuntu 22.04的VPS,目前域名和主机都能正常工作,直接在浏览器输入URL就能访问我的网站。但当我尝试用Certbot申请SSL证书的时候,却碰到了认证失败的问题,想请大家帮忙看看。
我执行的命令是:
sudo certbot --apache
选择要开启HTTPS的域名后,得到的错误输出如下:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Which names would you like to activate HTTPS for? We recommend selecting either all domains, or all domains in a VirtualHost/server block. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: cihanbatasul.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (Enter 'c' to cancel): 1 Requesting a certificate for cihanbatasul.com Certbot failed to authenticate some domains (authenticator: apache). The Certificate Authority reported these problems: Domain: cihanbatasul.com Type: unauthorized Detail: 92.205.171.180: Invalid response from http://cihanbatasul.com/.well-known/acme-challenge/gGguqH44EsxtOmUeswWsjDx9xtSR70HrJzwEBjXuaZQ: 404 Hint: The Certificate Authority failed to verify the temporary Apache configuration changes made by Certbot. Ensure that the listed domains point to this Apache server and that it is accessible from the internet. Some challenges have failed. Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
下面是我的两个Apache配置文件内容:
000-default.conf
<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
cihanbatasul.com.conf
<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. ServerName cihanbatasul.com DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined <Directory /var/www/html> Options FollowSymLinks AllowOverride All </Directory> # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn Alias /.well-known/acme-challenge/ /var/www/html/.well-known/acme-challenge/ <Location "/.well-known/acme-challenge/"> Options None AllowOverride None ForceType text/plain RedirectMatch 404 "^(?!/\.well-known/acme-challenge/[\w-]{43}$)" </Location> # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
我现在有两个困惑:
- 不确定
DocumentRoot是否配置正确,我是按照GoDaddy的文件树结构设置的([GoDaddy文件树结构]) - 找不到acme相关的验证文件,也不知道该怎么让这些文件能被Let's Encrypt的服务器访问到
希望有经验的朋友能帮我排查下问题,谢谢大家!
备注:内容来源于stack exchange,提问作者intero
相关产品推荐
相关产品推荐

