Quickstart: Meteor + Phusion Passenger

This 5 minute tutorial teaches you to start your application in a Phusion Passenger server, in development mode. Feel what Passenger is and how it works.

Are you looking to deploy your app to production with Passenger, maybe in combination with Nginx or Apache? Take a look at the deployment tutorial.

Table of contents

  1. Loading...

What is Passenger?

Passenger is an open source web application server. It handles HTTP requests, manages processes and resources, and enables administration, monitoring and problem diagnosis.

Passenger is very easy to use, makes deploying in production much easier and is scalable. If you aren't already familiar with the benefits, you can learn more about them.

This tutorial doesn't go very deep into Passenger's concepts. Instead, it serves to get you started as quickly as possible. When you're done with this tutorial, we'll explain the concepts in more detail.

Install Passenger

Preparing the example application

In this tutorial we will use an example Meteor application. The builtin Meteor leaderboard example is a good one.

$ cd ~
$ meteor create --example leaderboard
$ cd leaderboard

Running the server

You normally run your app like this when in development mode, right?

$ meteor run

It's similar with Passenger. Instead of meteor run, you run your app with passenger start:

$ passenger start
======= Phusion Passenger Standalone web server started =======
PID file: /Users/phusion/leaderboard/passenger.3000.pid
Log file: /Users/phusion/leaderboard/passenger.3000.log
Environment: development
Accessible via: http://0.0.0.0:3000/    1

You can stop Phusion Passenger Standalone by pressing Ctrl-C.
===============================================================
App 85125 stdout: [[[[[ ~/leaderboard ]]]]]   2
App 85125 stdout:
App 85125 stdout: => Started proxy.
App 85125 stdout: => Started MongoDB.
App 85125 stdout: => Started your app.
App 85125 stdout:
App 85125 stdout: => App running at: http://localhost:9822/  3

We see a couple of things here:

  1. Passenger reports that it has started a server, which is accessible via http://0.0.0.0:3000/. It also tells you where it has placed its PID file and log file.
  2. Internally, Passenger runs your Meteor app by invoking the command meteor run. You can see the output of that command in the lines that are marked with "App xxx stdout". The xxx is the PID of the meteor run command.
  3. meteor run starts its own server at http://localhost:9822/. But that is not the URL you should visit. Passenger listens on its own port, manages Meteor, and forwards requests to Meteor through the address http://localhost:9822/. So you should ignore this line.

So Passenger is now serving your app on http://0.0.0.0:3000/. If you go to that URL, you will should see your application:

$ curl http://0.0.0.0:3000/
...your app's front page HTML...

Stopping the server

If you stop Passenger, Passenger will stop your Meteor app.

There are two ways to stop the server. The first is by pressing Ctrl-C in the terminal.

$ passenger start
...
(press Ctrl-C here)
Stopping web server... done!

The second way is by starting a seperate terminal, changing the working directory to your application, and running passenger stop:

$ cd /path-to-your-app
$ passenger stop

Conclusion

Congratulations! Now that you've passed this tutorial and seen Passenger in action, you may be interested in follow-up tutorials.

Basics

Learn what Passenger is, how it fits in the stack, its fundamental concepts and its basic usage. Focuses mainly on development rather than production.

Read this
Deployment

Learn how easy it is to setup a server and how to deploy your app to production. No worries, we walk you through from the beginning to the end.

Read this

...or go back to the Library index.