根据官网教程 https://certbot.eff.org/lets-encrypt/ubuntuxenial-nginx 安装必须软件后
执行 $ sudo certbot --nginx
后报错:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
An unexpected error occurred:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 44: ordinal not in range(128)
Please see the logfiles in /var/log/letsencrypt for more details.
报错文件的内容是:
2018-03-17 13:06:34,407:DEBUG:certbot.main:certbot version: 0.21.1
2018-03-17 13:06:34,408:DEBUG:certbot.main:Arguments: []
2018-03-17 13:06:34,408:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#nginx,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2018-03-17 13:06:34,417:DEBUG:certbot.log:Root logging level set at 20
2018-03-17 13:06:34,418:INFO:certbot.log:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2018-03-17 13:06:34,419:DEBUG:certbot.plugins.selection:Requested authenticator None and installer None
2018-03-17 13:06:34,731:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
File "/usr/bin/certbot", line 11, in <module>
load_entry_point('certbot==0.21.1', 'console_scripts', 'certbot')()
File "/usr/lib/python3/dist-packages/certbot/main.py", line 1240, in main
return config.func(config, plugins)
File "/usr/lib/python3/dist-packages/certbot/main.py", line 1099, in certonly
installer, auth = plug_sel.choose_configurator_plugins(config, plugins, "certonly")
File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 194, in choose_configurator_plugins
authenticator = pick_authenticator(config, req_auth, plugins)
File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 40, in pick_authenticator
config, default, plugins, question, (interfaces.IAuthenticator,))
File "/usr/lib/python3/dist-packages/certbot/plugins/selection.py", line 77, in pick_plugin
verified.prepare()
File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 248, 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 248, 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 130, in prepare
self._initialized.prepare()
File "/usr/lib/python3/dist-packages/certbot_nginx/configurator.py", line 131, 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.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 44: ordinal not in range(128)
服务器是 ubuntu 16.04 nginx
1
dejavuwind 2018-03-17 21:49:54 +08:00
没怎么搞过 python,看这最后一行报错好像是跟 python 的默认编码有关?参考一下 SO 的这个
https://stackoverflow.com/questions/21129020/how-to-fix-unicodedecodeerror-ascii-codec-cant-decode-byte |
2
LeungJZ OP @dejavuwind
根本就不知道改哪个文件。。。 |
5
Hello1995 2018-03-17 23:17:10 +08:00
|
6
orzfly 2018-03-17 23:22:31 +08:00 1
File "/usr/lib/python3/dist-packages/certbot_nginx/nginxparser.py", line 123, in load
return loads(_file.read()) File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] 肯定是…… nginx 配置文件里有中文… |
8
blankme 2018-03-17 23:26:53 +08:00
你加 certonly 好了,有了证书自己改 nginx 的配置
|
9
LeungJZ OP |
10
mrcotter2013 2018-03-18 00:47:48 +08:00
错误提示中“ ordinal not in range(128)” 代表你的配置文件中使用了不在普通 ASCII 范围内,使用了特殊字符串,去掉
|
11
LeungJZ OP @mrcotter2013
额比如呢??这个我不知道有哪些。配置文件略多。 |
12
mrcotter2013 2018-03-18 00:56:02 +08:00
@LeungJZ #11 查 ASCII 表,'0xe6' 代表 'æ',搜索你的文件中是否有这个字符
|