[root@localhost https]# certbot –nginx
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running nginx -c /etc/nginx/nginx.conf -t.
nginx: [emerg] open() “/etc/nginx/nginx.conf” failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed
The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError(‘Error while running nginx -c /etc/nginx/nginx.conf -t.\n\nnginx: [emerg] open() “/etc/nginx/nginx.conf” failed (2: No such file or directory)\nnginx: configuration file /etc/nginx/nginx.conf test failed\n’,)
没有找到nginx配置路径,用–nginx-server-roo参数指定下路径即可
certbot –nginx –nginx-server-root /usr/local/etc/nginx
root@localhost https]# ./certbot-auto –nginx –nginx-server-root /usr/local/nginx/conf/
/root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6
DeprecationWarning
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Which names would you like to activate HTTPS for?
——————————————————————————-
1: 21mmm.com
2:www.21mmm.com
——————————————————————————-
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter ‘c’ to cancel): 1,2 #输入你要选择装证书的域名的序号,多个用逗号或空格分隔
然后就等待一会就好了。
中间遇到过404错误,然后给acme-challenge设置了下权限,就好了。chmod -R 777 acme-challenge
Failed authorization procedure. www.21mmm.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://www.21mmm.com/.well-known/acme-challenge/yXTgBiwlmzRWlPyrAuYS8yReULNmicbUveecrZuYAl0: “<html>
<head><title>404 Not Found</title></head>
<body bgcolor=”white”>
<center><h1>404 Not Found</h1></center>
<hr><center>”