首页 > 解决方案 > Meteor up - two apps running one virtual server

问题描述

I'm trying to run two meteor apps on one VPS machine using the Reverse Proxy setup with meteor-up. According to MUP everything is working fine, however, I can only load one of the websites. Both websites run independently on separate VPS machines and there are no errors when I deploy the app to the same server using MUP.

I've set both DNS to the same server 11.11.11.111, is this the problem. Port 80 and 443 are open.

The website that won't load states Your connection is not private.

Here are my what my mup files look like.

App1: mup.js

module.exports = {
  servers: {
    one: {
      host: '11.11.11.111',
      username: 'myuser',
      pem: 'key'
    }
  },

  app: {
    name: 'App1',
    path: '../',

    docker: {
      image: 'abernix/meteord:node-8.4.0-base',
    },

    // list of servers to deploy to, from the 'servers' list
    servers: {
      one: {},
    },

    // All options are optional.
    buildOptions: {
      // Set to true to skip building mobile apps
      // but still build the web.cordova architecture. (recommended)
      serverOnly: true,
      debug: false,
    },
    env: {
      // If you are using SSL, this needs to start with https
      ROOT_URL: 'https://app1.com',
      MONGO_URL: 'myMonogoDBlink'
    },

    enableUploadProgressBar: true, // default false.
  },

  proxy: {
    domains: 'app1.com, www.app1.com',
    ssl: {
      // Enable let's encrypt to create free certificates
      letsEncryptEmail: 'me@app1.com',
      forceSSL: true
    }
  }
};

App2: mup.js

module.exports = {
  servers: {
    one: {
      host: '11.11.11.111',
      username: 'myuser',
      pem: 'key'
    }
  },

  app: {
    // TODO: change app name and path
    name: 'App2',
    path: '../',

    servers: {
      one: {},
    },

    buildOptions: {
      serverOnly: true,
      debug: false,
    },

    env: {
      ROOT_URL: 'https://www.app2.com',
      MONGO_URL: 'myMonogoDBlink',
    },

    docker: {
      image: 'abernix/meteord:node-8.4.0-base',
    },

    enableUploadProgressBar: true
  },
  proxy: {
    domains: 'app2.com,www.app2.com',

    ssl: {
      // Enable Let's Encrypt
      letsEncryptEmail: 'me@app1.com',
      forceSSL: true
    }
  }
};

UPDATE

=> Servers
  - 11.11.11.11: Ubuntu 16.04

=> Docker Status
 - 11.11.11.11: 18.06.1-ce Running

=> Meteor Status
 - 11.11.11.11: running 
    Created at 2018-09-19T12:16:33.361397945Z
    Restarted 0 times
=> Reverse Proxy Status
 - 11.11.11.11:
   - NGINX:
     - Status: running
     - Ports:
       - HTTPS: 443
       - HTTP: 80
   - Let's Encrypt
     - Status: running

标签: meteormeteor-upmup

解决方案


好的,我想我已经缩小了问题范围并找到了解决方案。

我正在使用 Cloudflare,并且我的 DNS 附加了规则以将所有流量推送到www. 加密 SSL 部分似乎是问题发生的地方。它被设置为灵活。这似乎导致我的连接在 http 和 https 之间反弹。

有效的解决方案是将 Cloudflare 中的加密 SSL 部分更改为 Full。

我还清除了 Mac 上的 DNS 缓存,但我认为这与解决方案没有任何关系。 刷新 mac DNS 缓存


推荐阅读