首页 > 解决方案 > NGinx/wordpress - Letsencrypt 无法创建证书

问题描述

我正在尝试使用letsencrypt为我的wordpress网站生成证书。我使用 NGinx 作为网络服务器。我尝试了很多事情,但一切似乎都失败了,我仍然收到相同的错误消息(我使用的命令是sudo certbot --nginx,但我也尝试过:)sudo certbot --nginx --d www.mywebsite.fr

    Failed authorization procedure. mywebsite.fr (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://mywebsite.fr/.well-known/acme-challenge/q9Ck4GJMSTpqiJAQXUz47ShS544l40Kx1u3DN3mDa90 [51.158.126.54]: "<html>\r\n<head><title>404 Not Found</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>404 Not Found</h1></center>\r\n<hr><center>"

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: mywebsite.fr
   Type:   unauthorized
   Detail: Invalid response from
   http://mywebsite.fr/.well-known/acme-challenge/q9Ck4GJMSTpqiJAQXUz47ShS544l40Kx1u3DN3mDa90
   [51.158.126.54]: "<html>\r\n<head><title>404 Not
   Found</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>404
   Not Found</h1></center>\r\n<hr><center>"

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address.

我的 DNS 文件没问题(我用 a 检查过nslookup)。我尝试创建一个 .well-known/acme-challenge 目录,但这并没有解决问题。我也尝试修改我的 .htaccess 文件,但也没有用。它看起来像这样:

RewriteRule "^.well-known/acme-challenge" - [L]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^\.well-known/.+ - [END]
# BEGIN WordPress
# Les directives (lignes) entre 'BEGIN WordPress' et 'END WordPress' sont
# généré dynamiquement, et ne doivent uniquement être modifiées via les filtres WordPress.
# Toute modification des directives entre ces marqueurs sera outrepassée.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /www/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /www/index.php [L]
</IfModule>

# END WordPress

有人对此有任何线索吗?

提前致谢。

标签: wordpressnginxlets-encrypt

解决方案


好的,所以我终于找到了问题的根源:我的启用站点的文件夹中有一个 mywebsite.conf~ 文件和一个 mywebsite.conf 文件。删除 mywebsite.conf~ 解决了我的问题。


推荐阅读