Hosting multiple apps on Linode with mup


#1

Hi,

I have successfully used mup to deploy a meteor app to a linode instance. In mup.json I have specified the env{} to have a port of 3000

With a new app, I set the port of 3001 and so adjust my nginx vhost accordingly, but the page gives 502 Bad Gateway. Nginx nginx/1.6.2

Below is the nginx vhost and the mup.json

Any ideas?

Thanks

server {
  listen                *:80;

  server_name           example.com;

  access_log            /var/log/nginx/example.com.access.log;
  error_log             /var/log/nginx/example.com.error.log;

  location / {
    proxy_pass http://127.0.0.1:3001;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header X-Forwarded-For $remote_addr;
  }
}
// mup.json

{
  // Server authentication info
  "servers": [
    {
      "host": "109.74.205.44",
      "username": "jonwhittlestone",
      // "password": "password"
      // or pem file (ssh based authentication)
      "pem": "~/.ssh/id_rsa.bak.pub"
    }
  ],

  // Install MongoDB in the server, does not destroy local MongoDB on future setup
  "setupMongo": false,

  // WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
  "setupNode": true,

  // WARNING: If nodeVersion omitted will setup 0.10.33 by default. Do not use v, only version number.
  "nodeVersion": "0.10.28",

  // Install PhantomJS in the server
  "setupPhantom": true,

  // Application name (No spaces)
  "appName": "example",

  // Location of app (local directory)
  "app": "/Users/jonwhittlestone/code/example",

  // Configure environment
  "env": {
    "ROOT_URL": "http://meteorfreelancer.com",
    "PORT": "3001", // The port you want to bind to on your server.
    "UPSTART_UID": "jonwhittlestone" // The user you want to run meteor as.
  },

  // Meteor Up checks if the app comes online just after the deployment
  // before mup checks that, it will wait for no. of seconds configured below
  "deployCheckWaitTime": 15
}


#2

@howapped: I have deployed an app using port 3000 and the setting is pretty much the same as yours.

However, I can only access my website by going to http://mywebsite.com:3000. How can I make it accessible by going to http://mywebsite.com? (i.e. without specify port 3000 in my URL)


#3

@williams did you specify

    server_name mywebsite.com

and point your dns to your server’s IP? If so nginx should serve your app on http://mywebsite.com

If you’re still having trouble you can try this tool (work in progress) which installs and configures nginx automatically with your deployment.


#4

@hellstad yes I did. I suspect meteor up is not running my meteor app in nginx vhosts.

I go to builtwith.com and check my app and cannot find nginx listed in the tool my website used. Some of my settings, e.g. redirect, is ignored.

I am new to nginx. Do you know how to run Meteor app in nginx vhost?


#5

Thanks folks - I was deploying the site as a holding page, with a view to building on later. I just disabled my need for a database and the problem went away.


#6

@williams kill your meteor app and go to http://mywebsite.com, see if it shows the default nginx page. I think you might not have setup nginx properly.


#7

@hellstad I got the nginx error page if I killed the meteor app.


#8

@hellstad I think I solved the problem by changing the UPSTART_UID to “root”.


#9

I’d like to try this. Can you share your experience further, please?