2

我正在尝试使用 certbot 从我家的服务器将 ssl 添加到已经工作的站点(krementimg.us.to)。此服务器在 Ubuntu 16.04 上运行 Nginx 后面的节点应用程序。按照此处的说明,我的 etc/nginx/sites-available/default(我的配置文件)如下所示:

server {
    server_name krementimg.us.to;
    client_max_body_size 20M;
    listen 80 default_server;
    listen [::]:80 default_server;    
    root /var/www/html;

    location / {
                proxy_pass http://localhost:443;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
     }
}

Nginx 侦听端口 80 并将客户端定向到在端口 443 上运行的应用程序。所有这些工作正常,但是,当我sudo certbot --nginx按照 certbot 网站上的说明运行命令时,我收到错误

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: krementimg.us.to
   Type:   connection
   Detail: Error getting validation data

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address. Additionally, please check that
   your computer has a publicly routable IP address and that no
   firewalls are preventing the server from communicating with the
   client. If you're using the webroot plugin, you should also verify
   that you are serving files from the webroot path you provided.

我想在我的网站上有 ssl,那么我该如何解决这个问题?

4

1 回答 1

0

我对 certbot --nginx 有一些问题,我建议你尝试停止 Nginx 服务器,然后在独立模式下执行 certbot。命令是:

sudo certbot certonly --standalone -d example.com -d www.example.com

试试看你和前面的命令有没有区别。如果可以,则需要完成 Nginx 的配置(监听 443 端口并加载权限证书)。我写了一个帖子。详情:

https://medium.com/@robertodev/how-to-enable-https-with-lets-encrypt-on-your-web-server-cc1ce465ad2c

于 2017-11-24T18:55:09.117 回答