我正在尝试将Certbot与我的Nginx应用程序一起使用,但是每次我运行sudo certbot --nginx
并选择“ 1:尝试重新安装此现有证书”时,都会出现此错误:
Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/nycrussian
nginx: [emerg] a duplicate listen [::]:443 in /etc/nginx/sites-enabled/nycrussian:16
Rolling back to previous server configuration...
nginx restart failed:
b''
b''
IMPORTANT NOTES:
- We were unable to install your certificate, however, we
successfully restored your server to its prior configuration.
我已阅读这是由于使用ivp6only
或默认页面所致,我已删除默认配置,并且只有一个[::]:443
实例
这是我的配置(我还将端口转发设置从80设置为443):
server {
listen 80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
server {
listen [::]:443 ipv6only=off;
server_name nycrussian.com;
location / {
include proxy_params;
proxy_pass http://unix:/root/RussianInstitute/nycrussian.sock;
}
}
以下是grep -R 443 /etc/nginx
的结果:
/etc/nginx/sites-enabled/nycrussian: listen [::]:443 ipv6only=off;
/etc/nginx/sites-available/nycrussian: listen [::]:443 ipv6only=off;
链接在一起的
此外,nginx -t
屈服:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful