gem version

Quickstart

Relevant selection for this article:

Ruby

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.

Table of contents

  1. Loading...

Preparing the example application

In this tutorial we will use an example "hello world" application. Clone the one you like.

Ruby on Rails example:

$ git clone https://github.com/phusion/passenger-ruby-rails-demo.git
$ cd passenger-ruby-rails-demo

Sinatra example:

$ git clone https://github.com/phusion/passenger-ruby-sinatra-demo.git
$ cd passenger-ruby-sinatra-demo

Updating your gem bundle

Open your app's Gemfile and add "passenger":

gem "passenger", ">= 5.3.2", require: "phusion_passenger/rack_handler"

Now open a terminal, go to your application's directory and run bundle install to install your gem bundle:

$ cd /path-to-your-app
$ bundle install
...
Installing passenger x.x.x
...
Your bundle is complete!

Running the server

You are now ready to run the Passenger server. Run:

$ bundle exec passenger start
======= Phusion Passenger Standalone web server started =======
PID file: /Users/phusion/myapp/tmp/pids/passenger.3000.pid
Log file: /Users/phusion/myapp/log/passenger.3000.log
Environment: development
Accessible via: http://0.0.0.0:3000/

You can stop Phusion Passenger Standalone by pressing Ctrl-C.
===============================================================

As you can see in the output, Passenger is now serving your app on http://0.0.0.0:3000/. So 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...

You can also use "bundle exec rails server"

If you use Rails, then you can also run bundle exec rails server. As long as you have the above Gemfile entry, that command will start a Passenger-based server.

Logs

Passenger prints its own logs not only to the terminal, but also to a log file. During startup, Passenger tells you what log file it used. This is typically log/passenger.XXXX.log.

There are also the application logs, such as log/development.log and log/production.log. These logs are completely separate from Passenger's own logs. If you use Rails, then Passenger will also print your application logs to the terminal, but it will not print them into Passenger's log file.

If you do not use Rails then Passenger may not print your logs to the terminal at all. In that case it is up to you to manually view those log files, e.g. with the Unix tail tool.

Stopping the server

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

$ bundle exec 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 bundle exec passenger stop:

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

Conclusion

success

Congratulations! Now that you've passed this tutorial and seen Passenger in action. You can find the end result of this tutorial in the example application's git repository's end_result branch

Next step: installation

Continue

light mode dark mode
Passenger 6 Passenger 6