Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 赫罗库+;节点(解析服务器)和#x2B;nginx不工作_Node.js_Nginx_Heroku_Parse Platform - Fatal编程技术网

Node.js 赫罗库+;节点(解析服务器)和#x2B;nginx不工作

Node.js 赫罗库+;节点(解析服务器)和#x2B;nginx不工作,node.js,nginx,heroku,parse-platform,Node.js,Nginx,Heroku,Parse Platform,我知道有一个类似的问题,但这个问题更具体,因为我设置了nginx服务器,但是位置参数没有任何影响: 这是我的nginx.conf.erb: daemon off; #Heroku dynos have at least 4 cores. worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>; events { use epoll; accept_mutex on; worker_connections 1024;

我知道有一个类似的问题,但这个问题更具体,因为我设置了
nginx
服务器,但是
位置
参数没有任何影响:

这是我的
nginx.conf.erb

daemon off;
#Heroku dynos have at least 4 cores.
worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>;

events {
    use epoll;
    accept_mutex on;
    worker_connections 1024;
}

http {

    gzip on;
    server_tokens off;

    log_format l2met 'measure#nginx.service=$request_time request_id=$http_x_request_id';
    access_log logs/nginx/access.log l2met;
    error_log logs/nginx/error.log;

    include mime.types;
    default_type application/octet-stream;
    sendfile on;

    #Must read the body in 5 seconds.
    client_body_timeout 5;

    upstream app_server {
        server unix:/tmp/nginx.socket fail_timeout=0;
    }

    server {
        listen <%= ENV["PORT"] %>;
        server_name _;
        keepalive_timeout 5;

        # A try to override some pictures in parse
        # location /parse/files/0B5jvlihE6yxQed1w9vRSRW0DRldy3fbwqaCjpyF/ {
        #   add_header whereamI first;
        #   return 301 http://www.immobleupromotion.com/wp-content/uploads/2016/07/nice-ouest.jpg;
        # }

        # location /parse/files/{
        #   add_header whereamI second;
        #   return 301 http://www.immobleupromotion.com/wp-content/uploads/2016/07/nice-ouest.jpg;
        # }
        # location / {
        #   add_header whereamI parent;
        #   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        #   proxy_set_header Host $http_host;
        #   proxy_redirect off;
        #   proxy_pass http://app_server;
        # }
    }
}
以下是我的index.js(至少是相关部分):

最后但并非最不重要的一点:这是我的构建包

=== super-project Buildpack URLs
1. https://github.com/heroku/heroku-buildpack-nodejs.git
2. https://github.com/heroku/heroku-buildpack-nginx.git
而问题实际上是这正在工作:服务器通过nginx返回所有希望的响应,但是它基本上不应该返回,因为这意味着nginx代理完全没有用处,我不知道为什么


有什么想法吗?

“位置参数没有任何影响”-它们被注释掉了。如果你想启用它们,你需要从行的开头删除
#
。哈哈,不,如果它们被注释了,那么代理就不应该工作了。如果我激活它们,它的工作原理应该是完全相同的。哦,那么
/parse/files/
代理即使被注释掉也能工作?那是。。。奇数:p整个服务器在没有位置的情况下工作。代理是无用的
var httpServer = require('http').createServer(app);
httpServer.listen('/tmp/nginx.socket', function () {
    fs.openSync('/tmp/app-initialized', 'w');   
});
=== super-project Buildpack URLs
1. https://github.com/heroku/heroku-buildpack-nodejs.git
2. https://github.com/heroku/heroku-buildpack-nginx.git