代码之家  ›  专栏  ›  技术社区  ›  James Newton

乘客独立流星背后的一个自定义Nginx反向代理

  •  0
  • James Newton  · 技术社区  · 7 年前

    http://localhost:3000 . 我正在使用以下Nginx服务器指令:

    server {  
      listen 80;
    
      server_name example.com;
      charset utf-8;
    
      location ~ /(.+) {
        proxy_pass http://localhost:3000;
        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 ~ /(.+) 允许我在 public/index.html 如果有人要求 http://example.com/ http://example.com/whatever 将由流星应用程序处理,并提供流星酱。

    export ROOT_URL=http://localhost && export PORT=3000 && node main.js
    

    Putting Passenger Standalone behind an Nginx or Apache reverse proxy ,但是尽管我在乘客和Nginx配置上做了很多手脚,我还是只能看到 public/ 文件夹或流星应用程序,但不是两者都有。

    这是我的 Passengerfile.json

    {
      "app_type": "node",
      "startup_file": "main.js",
      "envvars": {
        "MONGO_URL": "mongodb://localhost:27017/example",
        "ROOT_URL": "http://example.com",
      },
      "log_file": "../passenger.log",
      "pid_file": "../passenger.pid",
      "environment": "production",
      "port": 3000,
      "daemonize": true,
      "user": "meteor"
    }
    

    我的Nginx指令是否与乘客在引擎盖下工作的方式相冲突?

    0 回复  |  直到 7 年前