受欢迎的博客标签

Let's Encrypt:nginx error:Error unicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 3494: invalid start byte - Let's Encrypt

Published

error:

unicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 3494: invalid start byte.

sudo certbot --nginx  -d www.site.com -d search.site.com

 


unicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 3494: invalid start byte

Saving debug log to /var/log/letsencrypt/letsencrypt.log

reason:

/etc/nginx/sites-enabled/default contains non 'utf-8' code.

 

slove:

delete non 'utf-8' code in /etc/nginx/sites-enabled/default and save file as utf-8 code.

 

 

/var/log/letsencrypt/letsencrypt.log

2020-03-01 07:22:10,676:DEBUG:certbot.main:certbot version: 0.27.0
2020-03-01 07:22:10,677:DEBUG:certbot.main:Arguments: ['--nginx', '-d', 'www.stockso.com', '-d', 'site.com', '-d', 'api.site.com']
2020-03-01 07:22:10,677:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#nginx,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2020-03-01 07:22:10,683:DEBUG:certbot.log:Root logging level set at 20
2020-03-01 07:22:10,683:INFO:certbot.log:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2020-03-01 07:22:10,684:DEBUG:certbot.plugins.selection:Requested authenticator nginx and installer nginx
2020-03-01 07:22:10,753:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
  File "/usr/bin/certbot", line 11, in <module>
    load_entry_point('certbot==0.27.0', 'console_scripts', 'certbot')()
  File "/usr/lib/python3/dist-packages/certbot/main.py", line 1364, in main
    return config.func(config, plugins)
  File "/usr/lib/python3/dist-packages/certbot/main.py", line 1106, in run
    installer, authenticator = plug_sel.choose_configurator_plugins(config, plugins, "run")
  File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 225, in choose_configurator_plugins
    authenticator = installer = pick_configurator(config, req_inst, plugins)
  File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 25, in pick_configurator
    (interfaces.IAuthenticator, interfaces.IInstaller))
  File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 106, in pick_plugin
    verified.prepare()
  File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 251, in prepare
    return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
  File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 251, in <listcomp>
    return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
  File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 132, in prepare
    self._initialized.prepare()
  File "/usr/lib/python3/dist-packages/certbot_nginx/configurator.py", line 141, in prepare
    self.parser = parser.NginxParser(self.conf('server-root'))
  File "/usr/lib/python3/dist-packages/certbot_nginx/parser.py", line 38, in __init__
    self.load()
  File "/usr/lib/python3/dist-packages/certbot_nginx/parser.py", line 45, in load
    self._parse_recursively(self.config_root)
  File "/usr/lib/python3/dist-packages/certbot_nginx/parser.py", line 66, in _parse_recursively
    self._parse_recursively(subentry[1])
  File "/usr/lib/python3/dist-packages/certbot_nginx/parser.py", line 56, in _parse_recursively
    trees = self._parse_files(filepath)
  File "/usr/lib/python3/dist-packages/certbot_nginx/parser.py", line 206, in _parse_files
    parsed = nginxparser.load(_file)
  File "/usr/lib/python3/dist-packages/certbot_nginx/nginxparser.py", line 123, in load
    return loads(_file.read())
  File "/usr/lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 3494: invalid start byte
2020-03-01 07:22:10,762:ERROR:certbot.log:An unexpected error occurred:
2020-03-01 07:22:57,089:DEBUG:certbot.main:certbot version: 0.27.0
2020-03-01 07:22:57,089:DEBUG:certbot.main:Arguments: ['--nginx', '-d', 'www.stockso.com', '-d', 'stockso.com', '-d', 'api.stockso.com', '-d', 'data.stockso.com', '-d', 'f10.stockso.com', '-d', 'so.stockso.com', '-d', 'search.stockso.com', '-d', 'www.iaspnetcore.com', '-d', 'search.iaspnetcore.com', '-d', 'iaspnetcore.com', '-d', 'www.msly.cn', '-d', 'search.msly.cn']
2020-03-01 07:22:57,090:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#nginx,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2020-03-01 07:22:57,095:DEBUG:certbot.log:Root logging level set at 20
2020-03-01 07:22:57,096:INFO:certbot.log:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2020-03-01 07:22:57,096:DEBUG:certbot.plugins.selection:Requested authenticator nginx and installer nginx
2020-03-01 07:22:57,165:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
  File "/usr/bin/certbot", line 11, in <module>
    load_entry_point('certbot==0.27.0', 'console_scripts', 'certbot')()
  File "/usr/lib/python3/dist-packages/certbot/main.py", line 1364, in main
    return config.func(config, plugins)
  File "/usr/lib/python3/dist-packages/certbot/main.py", line 1106, in run
    installer, authenticator = plug_sel.choose_configurator_plugins(config, plugins, "run")
  File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 225, in choose_configurator_plugins
    authenticator = installer = pick_configurator(config, req_inst, plugins)
  File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 25, in pick_configurator
    (interfaces.IAuthenticator, interfaces.IInstaller))
  File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 106, in pick_plugin
    verified.prepare()
  File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 251, in prepare
    return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
  File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 251, in <listcomp>
    return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
  File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 132, in prepare
    self._initialized.prepare()
  File "/usr/lib/python3/dist-packages/certbot_nginx/configurator.py", line 141, in prepare
    self.parser = parser.NginxParser(self.conf('server-root'))
  File "/usr/lib/python3/dist-packages/certbot_nginx/parser.py", line 38, in __init__
    self.load()
  File "/usr/lib/python3/dist-packages/certbot_nginx/parser.py", line 45, in load
    self._parse_recursively(self.config_root)
  File "/usr/lib/python3/dist-packages/certbot_nginx/parser.py", line 66, in _parse_recursively
    self._parse_recursively(subentry[1])
  File "/usr/lib/python3/dist-packages/certbot_nginx/parser.py", line 56, in _parse_recursively
    trees = self._parse_files(filepath)
  File "/usr/lib/python3/dist-packages/certbot_nginx/parser.py", line 206, in _parse_files
    parsed = nginxparser.load(_file)
  File "/usr/lib/python3/dist-packages/certbot_nginx/nginxparser.py", line 123, in load
    return loads(_file.read())
  File "/usr/lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 3494: invalid start byte
2020-03-01 07:22:57,167:ERROR:certbot.log:An unexpected error occurred:
2020-03-01 07:24:44,141:DEBUG:certbot.main:certbot version: 0.27.0
2020-03-01 07:24:44,142:DEBUG:certbot.main:Arguments: ['--nginx', '-d', 'www.stockso.com', '-d', 'site.com', '-d', 'api.site.com']
2020-03-01 07:24:44,142:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#nginx,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2020-03-01 07:24:44,148:DEBUG:certbot.log:Root logging level set at 20
2020-03-01 07:24:44,148:INFO:certbot.log:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2020-03-01 07:24:44,149:DEBUG:certbot.plugins.selection:Requested authenticator nginx and installer nginx
2020-03-01 07:24:44,218:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
  File "/usr/bin/certbot", line 11, in <module>
    load_entry_point('certbot==0.27.0', 'console_scripts', 'certbot')()
  File "/usr/lib/python3/dist-packages/certbot/main.py", line 1364, in main
    return config.func(config, plugins)
  File "/usr/lib/python3/dist-packages/certbot/main.py", line 1106, in run
    installer, authenticator = plug_sel.choose_configurator_plugins(config, plugins, "run")
  File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 225, in choose_configurator_plugins
    authenticator = installer = pick_configurator(config, req_inst, plugins)
  File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 25, in pick_configurator
    (interfaces.IAuthenticator, interfaces.IInstaller))
  File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 106, in pick_plugin
    verified.prepare()
  File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 251, in prepare
    return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
  File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 251, in <listcomp>
    return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
  File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 132, in prepare
    self._initialized.prepare()
  File "/usr/lib/python3/dist-packages/certbot_nginx/configurator.py", line 141, in prepare
    self.parser = parser.NginxParser(self.conf('server-root'))
  File "/usr/lib/python3/dist-packages/certbot_nginx/parser.py", line 38, in __init__
    self.load()
  File "/usr/lib/python3/dist-packages/certbot_nginx/parser.py", line 45, in load
    self._parse_recursively(self.config_root)
  File "/usr/lib/python3/dist-packages/certbot_nginx/parser.py", line 66, in _parse_recursively
    self._parse_recursively(subentry[1])
  File "/usr/lib/python3/dist-packages/certbot_nginx/parser.py", line 56, in _parse_recursively
    trees = self._parse_files(filepath)
  File "/usr/lib/python3/dist-packages/certbot_nginx/parser.py", line 206, in _parse_files
    parsed = nginxparser.load(_file)
  File "/usr/lib/python3/dist-packages/certbot_nginx/nginxparser.py", line 123, in load
    return loads(_file.read())
  File "/usr/lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 3494: invalid start byte
2020-03-01 07:24:44,219:ERROR:certbot.log:An unexpected error occurred:

 

 The Certificate Authority failed to download the challenge files from the temporary standalone webserver started by Certbot on port 80. Ensure that the listed domains point to this machine and that it can accept inbound connections from the internet.

 

Action

step 1:#certbot certonly --register-unsafely-without-email
step 2:press 2
1: Nginx Web Server plugin (nginx)
2: Spin up a temporary webserver (standalone)
3: Place files in webroot directory (webroot)
step 3: Enter the domain name(s)
Please enter the domain name(s) you would like on your certificate (comma and/or
space separated) (Enter 'c' to cancel): site.com www.site.com 
Requesting a certificate for msly.cn and 3 more domains


 

Error message :

     -1 }">Requesting a certificate for misteratunas.duckdns.org and www.misteratunas.duckdns.org
 -1 }">

 -1 }">
Certbot failed to authenticate some domains (authenticator: standalone). The Certificate Authority reported these problems:
 -1 }">  Domain: misteratunas.duckdns.org
 -1 }">  Type:   unauthorized
 -1 }">  Detail: Invalid response from http://misteratunas.duckdns.org/.well-known/acme-challenge/kGAPgqHLinKRi7w73TzUJzhrZnt1TEpOqcvjKivsHsc [90.90.123.131]: "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<title>openmediavault - HTTP 404 error</title>\n\t\t<meta charset=\"UTF-8\">\n\t\t<meta http-equiv=\"X-U"
 -1 }">

 -1 }">  Domain: www.misteratunas.duckdns.org
 -1 }">  Type:   unauthorized
 -1 }">  Detail: Invalid response from http://www.misteratunas.duckdns.org/.well-known/acme-challenge/e8xohuICKs74o3ByGN3Gr3pqUPiZmcWMIJKN-YdwG_A [90.90.123.131]: "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<title>openmediavault - HTTP 404 error</title>\n\t\t<meta charset=\"UTF-8\">\n\t\t<meta http-equiv=\"X-U"
 -1 }">

 -1 }">
Hint: The Certificate Authority failed to download the challenge files from the temporary standalone webserver started by Certbot on port 80. Ensure that the listed domains point to this machine and that it can accept inbound connections from the internet.
 -1 }">