更新let's encrypt证书遇到The client lacks sufficient authorization Invalid response from http问题的解决方法

导语:叶子有一台服务器上的网站使用了let’s encrypt的免费ssl证书,前几次使用certbot-auto更新的时候成功了,但最近一次更新的时候却提示了错误:The client lacks sufficient authorization Invalid。

错误提示

执行更新一下代码:

./certbot-auto renew --quiet --no-self-upgrade

提示以下错误:

Attempting to renew cert (www.test.com) from /etc/letsencrypt/renewal/www.test.com.conf produced an unexpected error: Failed authorization procedure. www.test.com (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://www.test.com/.well-known/acme-challenge/91QSxAkLXOPsiMzpwign3NmIb28D_AX4Yvb5MI1uBhE: "<!DOCTYPE html>\r\n<html lang=\"en-US\">\r\n <head> \r\n <meta charset=\"UTF-8\" /> \r\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=e". Skipping.

错误原因

经过排查,发现错误出现的原因是因为叶子的http方式使用了一个目录,https的方式使用了另一个目录,并且在vhost中80端口的http请求全部301跳转到了443端口的https请求上,但是在letsencrypt证书配置中却指向了http的目录,当更新的时候,certbot-auto往该目录写入一个验证文件,而由于发生301跳转,certbot-auto无法在http下访问到该验证文件。

前几次更新成功的原因是,当时没有配置http到https的301跳转,certbot-auto能访问到http方式下的验证文件。

解决方法

修改www.test.com.conf中的配置,将目录改为https方式的目录。

vi /etc/letsencrypt/renewal/www.test.com.conf

[[webroot_map]]
www.test.com = /www/web/testcomssl/public_html

/www/web/testcomssl/public_html是https网站的目录。

执行更新代码:

./certbot-auto renew --quiet --no-self-upgrade

重启nginxd:

service nginxd restart

结束

你学会了吗?


Warning: copy(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /opt/lampp/htdocs/wordpresssummer/wp-content/themes/summerleaf/inc/summer_setting.php on line 546

Warning: copy(): Failed to enable crypto in /opt/lampp/htdocs/wordpresssummer/wp-content/themes/summerleaf/inc/summer_setting.php on line 546

Warning: copy(https://www.wordpressleaf.com/wp-content/themes/summerleaf/images/tx/44.png): failed to open stream: operation failed in /opt/lampp/htdocs/wordpresssummer/wp-content/themes/summerleaf/inc/summer_setting.php on line 546

发表评论

邮箱地址不会被公开。 必填项已用*标注