Popular blog tags

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: