HTTPS POST请求无法通过nginx / nodejs Bad Gateway

时间:2017-04-24 02:26:30

标签: node.js nginx

nginx route 我有一个运行node.js的rpi2,在端口442上通过.env配置了应用程序.Nginx配置为使用letsencrypt证书提供https。我在http上尝试了自己的节点应用程序,它的反应很好。我在局域网上从我的mac尝试了https on nginx上的服务index.html,它运行正常。现在的问题是我试图将它们结合起来。

我从hurl.it测试发布但是网站错误和网站nginx上的错误日志显示错误:

  

POST / API / switches / sw1?password = 123456 HTTP / 1.1",上游:   " http://192.168.1.53:442/50x.html",主持人:" subdomain.domain.com"   2017/04/23 20:08:38 [错误] 20424#0:* 4上游过早关闭   从上游,客户端读取响应头时连接:   192.168.1.56,server:subdomain.domain.com,request:" GET / aism / HTTP / 1.1",upstream:" http://192.168.1.53:442/aism/",host:   " subdomain.domain.com" 2017/04/23 20:08:38 [错误] 20424#0:* 4   上游过早关闭连接,同时读取响应头   from upstream,client:192.168.1.56,server:subdomain.domain.com,   请求:" GET / aism / HTTP / 1.1",上游:   " http://192.168.1.53:442/50x.html",主持人:" subdomain.domain.com"   2017/04/23 20:09:25 [错误] 20467#0:* 1上游过早关闭   从上游,客户端读取响应头时连接:   23.20.198.108,server:subdomain.domain.com,request:" POST / API / switches / sw1?password = 123456 HTTP / 1.1",upstream:   " http://192.168.1.53:442/API/switches/sw1?password=123456",主持人:   " subdomain.domain.com"

这是我的网站配置:

#server {
#        listen 80;
#        listen [::]:80;
#        server_name subdomain.domain.com;
#        return 301 https://$server_name$request_uri;
#}

server {
        listen 443 ssl;
        listen [::]:443 ssl;
        server_name subdomain.domain.com;

        ssl_certificate          /etc/letsencrypt/live/subdomain.domain.com/fullchain.pem;
        ssl_certificate_key      /etc/letsencrypt/live/subdomain.domain.com/privkey.pem;

        root /www/subdomain.domain.com/aism;
        index index.php index.html index.htm;

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;

        # Error & Access logs
        error_log /www/subdomain.domain.com/logs/error.log error;
        access_log /www/subdomain.domain.com/logs/access.log;

        location / {
                index index.html index.php;
                proxy_pass http://192.168.1.53:442;
                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;
        }
        location ~ /.well-known {
                allow all;
        }
        location /public {
                root /www/subdomain.domain.com/aism;
        }
        location ~ ^/(images/|img/|javascript/|js/|css/|stylesheets/|flash/|media/|static/) {
        }
        #location ~ [^/].php(/|$) {
        #        fastcgi_split_path_info ^(.+?.php)(/.*)$;
        #        fastcgi_pass unix:/var/run/php5-fpm.sock;
        #        fastcgi_index index.php;
        #        include fastcgi_params;
        #}
}

我的网站配置文件有什么问题?

我正在向我的路由器的公共IP发送muy帖子:

https://routerIP/API/switches/sw1?password=123456

由路由器

路由到192.168.1.53:443

根据配置文件代理到192.168.1.53:442

0 个答案:

没有答案