如何解决Certbot安装在Nginx上不起作用
我正在尝试使用certbot将证书安装到我的子域中。 它说我的nginx配置中没有server_name指令,但是我有,我做了nginx -t,它说配置还可以。
这是certbot的命令行输出
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx,Installer nginx
No names were found in your configuration files. Please enter in your domain
name(s) (comma and/or space separated) (Enter 'c' to cancel): subdomain.website.com
Attempting to parse the version 1.9.0 renewal configuration file found at /etc/letsencrypt/renewal/website.com.
conf with version 0.40.0 of Certbot. This might not work.
Cert not yet due for renewal
You have an existing certificate that has exactly the same domains or certificate name you requested and isn't close to expiry.
What would you like to do?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Attempt to reinstall this existing certificate
2: Renew & replace the cert (limit ~5 per 7 days)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1
Keeping the existing certificate
Could not automatically find a matching server block for subdomain.website.com. Set the `server_name` directive to use the Nginx installer.
IMPORTANT NOTES:
- Unable to install the certificate
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/subdomain.website.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/subdomain.website.com/privkey.pem
Your cert will expire on 2021-01-01. To obtain a new or tweaked
version of this certificate in the future,simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates,run "certbot renew"
这是我的nginx配置。
server {
listen 80;
root /var/www/html;
index index.html;
server_name website.com www.website.com;
location / {
try_files $uri =404;
}
error_log /var/log/nginx/website.com/error.log;
}
server {
listen 80;
server_name subdomain.website.com;
location / {
proxy_pass http://localhost:3000;
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。