每当我运行certbot --nginx
命令时,它永远不会完成该过程。
完整输出(以root身份运行):
$ certbot --nginx --agree-tos --redirect --uir --hsts --staple-ocsp --must-staple -d <DOMAINS> --email <EMAIL>
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for <DOMAIN>
http-01 challenge for <DOMAIN>
nginx: [emerg] duplicate listen options for [::]:80 in /etc/nginx/sites-enabled/django:50
Cleaning up challenges
nginx restart failed:
b''
b''
正在运行certbot certificates
:
$ certbot certificates
Saving debug log to /var/log/letsencrypt/letsencrypt.log
-------------------------------------------------------------------------------
No certs found.
-------------------------------------------------------------------------------
我搞砸的唯一一件事是在第一次运行certbot之前没有正确配置我的DNS(搞砸了我的A记录,等等;我是新来的:P),但是我不知道该怎么做向前迈进;这是我的第一个网络服务器,所以我仍然处于一个学习曲线中。我不确定这是配置错误还是别的。
有关信息,我正在运行DigitalOcean Django / Ubuntu 16.04 droplet(仅编辑/ etc / nginx / sites-available / default,以更改server_name)。将在下面更新所需的任何其他信息;提前致谢。 ^ _ ^
=============================================== ==========================
编辑1。 的/ etc / nginx的/ / django的启用位点-
upstream app_server {
server unix:/home/django/gunicorn.socket fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
client_max_body_size 4G;
server_name _;
keepalive_timeout 5;
# Your Django project's media files - amend as required
location /media {
alias /home/django/django_project/django_project/media;
}
# your Django project's static files - amend as required
location /static {
alias /home/django/django_project/django_project/static;
}
# Proxy the static assests for the Django Admin panel
location /static/admin {
alias /usr/lib/python2.7/dist-packages/django/contrib/admin/static/admin/;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://app_server;
}
}
答案 0 :(得分:1)
我认为问题在于您尝试在同一端口上指定两个default_server
指令。这是无效的 - 只能有一个默认服务器。如下更改配置可以解决您的问题:
listen 80;
listen [::]:80 default_server;
您也可以删除ipv6only
指令,因为这是默认设置。