自定义Nginx反向代理背后的Meteor乘客独立

时间:2019-08-28 08:33:38

标签: nginx meteor passenger

我创建了一个运行在http://localhost:3000上的Meteor应用。我正在使用以下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)都将由Meteor应用处理,并与Meteor酱一起使用。

使用节点启动应用程序时,我可以在生产环境中使用它。

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

但是,我为使它与Phusion Passenger一起使用而进行的所有尝试都失败了。我一直按照Putting Passenger Standalone behind an Nginx or Apache reverse proxy的说明进行操作,但是尽管我忙于使用Passenger和Nginx配置,但我只能看到public/文件夹或Meteor应用程序的内容,而不能看到两者。< / p>

这是我的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 个答案:

没有答案