为Beego设置nginx代理配置的正确方法是什么?

时间:2019-04-30 17:53:45

标签: nginx ubuntu-18.04 nginx-config beego

在一台装有Ubuntu 18.04.1 Server Edition的PC上,我正在开发一个为其注册域名的网页。 为了从http传递到https,我尝试使用我们的加密服务https://letsencrypt.org/

我暂时禁用了我用于连接PC的Ubuntu 18.04.02台式机笔记本电脑中的防火墙: riccardo @ riccardo-HP-Laptop-15-da0xxx:〜$ sudo ufw状态 riccardo的[sudo]密码: 状态:无效

以及在我正在开发网页的Ubuntu 18.04.01 Server PC中:

marco @ pc01:〜$ sudo ufw状态 marco的[sudo]密码: 状态:无效

在执行命令以获取证书时:

marco@pc01:~/go/src/MyPage$ sudo certbot certonly --webroot -w /home/marco/go/src/MyPage -d ggc.world -d www.ggc.world
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for ggc.world
http-01 challenge for www.ggc.world
Using the webroot path /home/marco/go/src/MyPage for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. www.ggc.world (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from
http://www.ggc.world/.well-known/acme-challenge/Gu8UD5QRmXl5pp2fJX1c3Qc3pAK_gP-cpuZA0tTaAi8 [109.116.160.164]: "<html>\n<head>\n  <title>404 Not  
Found</title>\n</head>\n<body bgcolor=\"#ffffff\">\n  <h2>404 Not Found</h2>\n  <p></p>\n</body>\n</html>", ggc.world (http-01): urn:ietf:params:acme:error:
unauthorized :: The client lacks sufficient authorization :: Invalid response from http://ggc.world/.well-known/acme-challenge/gGMNXHbKyuSyV_WZ-
z7NghdqamkU6YCzNVeohBOrtn0 [109.116.160.164]: "<html>\n<head>\n  <title>404 Not Found</title>\n</head>\n<body bgcolor=\"#ffffff\">\n  <h2>404 Not 
Found</h2>\n  <p></p>\n</body>\n</html>"

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

   Domain: www.ggc.world
   Type:   unauthorized
   Detail: Invalid response from
   http://www.ggc.world/.well-known/acme-challenge/Gu8UD5QRmXl5pp2fJX1c3Qc3pAK_gP-cpuZA0tTaAi8
   [109.116.160.164]: "<html>\n<head>\n  <title>404 Not
   Found</title>\n</head>\n<body bgcolor=\"#ffffff\">\n  <h2>404 Not
   Found</h2>\n  <p></p>\n</body>\n</html>"

   Domain: ggc.world
   Type:   unauthorized
   Detail: Invalid response from
   http://ggc.world/.well-known/acme-challenge/gGMNXHbKyuSyV_WZ-z7NghdqamkU6YCzNVeohBOrtn0
   [109.116.160.164]: "<html>\n<head>\n  <title>404 Not
   Found</title>\n</head>\n<body bgcolor=\"#ffffff\">\n  <h2>404 Not
   Found</h2>\n  <p></p>\n</body>\n</html>"

   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.

“让我们加密”论坛中的社区负责人断言,我的nginx的代理配置不起作用,因为它可能有问题。

作为Golang的MVC框架,我正在使用Beego。 据我在网上和某些书籍中所见,nginx的default.conf中的代理配置是将NGINX用作Beego的网络服务器的唯一方法: -https://beego.me/docs/deploy/nginx.md -摘自Go Web Development Cookbook:https://drive.google.com/open?id=1wUA_Yjh2MrCCqS9rGnITtBzm00Zum2II -摘自Nginx Cookbook(2017):     -https://drive.google.com/open?id=1xO0fNg9JOHz4vh94EHd4FTs_hBjJAiqb     -https://drive.google.com/open?id=1bXTcSmA5ib57HppOujaTtjlTLmE85pp2

marco@pc01:~$ nginx -v
nginx version: nginx/1.15.12

这是我的/etc/nginx/conf.d/default.conf:

server {
    listen       80;
    server_name ggc.world www.ggc.world;

    location / {
        proxy_pass http://192.168.1.7:8080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

所以...我的问题是: 为了将nginx用作Beego的Web服务器,为Beego设置nginx的代理配置的正确方法是什么?

在这里您可以找到/var/log/letsencrypt.log文件: letsencrypt.log

期待您的帮助。 马可

0 个答案:

没有答案