1. Home
  2. Authoring and Development
  3. What is mod_passenger?

What is mod_passenger?

What is mod_passenger?

mod_passenger enables Phusion Passenger to host Ruby, Python, and Node.js apps on the Apache server. Phusion Passenger specializes in managing these types of apps by restarting them in the case of an app crash, keeping heavy-resource usage in check, and more. By enabling this feature, you will be able to add Ruby, Python, and Node.js apps onto your server.

If you are interested in Phusion Passenger configurations with Apache, see Phusion Passenger’s Apache configuration page.

How do I use mod_passenger?

Setting up mod_passenger requires you to enable the module in the Apache Options interface and to set up your web app.

Enabling mod_passenger

You can enable mod_passenger in your VPS or Dedicated Account Control Center (ACC). To enable, follow these steps:

  1. Log in to the ACC on your VPS or Dedicated account
  2. In the left sidebar, click Dedicated, then click Apache Options in the drop-down
  3. In the Apache Module section, check the box next to mod_passenger
  4. Click the Make Changes button

This will enable mod_passenger on your server, though it may take up to 15 minutes for the change to go into effect.

Setting Up Apps

You can set up a variety of web app types once mod_passenger has been enabled. You can find the basic steps for setting up the different kinds of web apps below.

Setting Up Ruby

After mod_passenger has been enabled, you can set up your Ruby web app.

Adding a Ruby app does not require much additional set up. Create the Ruby app on your server, then map a domain to the “public” directory within the app.

After installing an app, you will need to restart the Apache server. For information about how to do this from the ACC, see our How to Restart Apache article.

Once you have restarted the Apache server, Phusion Passenger will automatically detect your Ruby app and serve it on the domain.

Setting Up Node.js
Add Node.js App

To set up a Node.js apps with mod_passenger, create the Node.js app on the server, then map a domain to the “public” directory within the app.

Add Directives to .htaccess

Next, add the following directives to the .htaccess file in the “public” directory. For help finding the .htaccess file, see our Accessing Your .htaccess File article.

PassengerAppType node
PassengerStartupFile app.js
PassengerAppRoot /full/path/to/app

Replace /full/path/to/app with the absolute path to your app directory.

Restart Apache

After installing an app, you will need to restart the Apache server. For information about how to do this from the ACC, see our How to Restart Apache article.

After restarting Apache, Phusion Passenger should now detect the Node.js app and serve it over the domain.

Setting Up Python

After enabling mod_passenger, you can host Python web apps, like Flask or Django, on your server.

Add Python App

Add the Python web app to your server, then map a domain to the “public” directory within the app.

Add Directives to .htaccess

Next, you’ll need to add a few lines to the directory’s .htaccess file so that Phusion Passenger recognizes the app. For information about accessing your .htaccess file, see our Accessing Your .htaccess File article. Enter the following lines in your .htaccess file:

PassengerAppType wsgi
PassengerStartupFile passenger_wsgi.py
PassengerAppRoot /full/path/to/app

Replace passenger_wsgi.py with your app’s WSGI entry point file name and replace /full/path/to/app with the absolute path to your app directory.

Restart Apache

After installing an app, you will need to restart the Apache server. For information about how to do this from the ACC, see our How to Restart Apache article.

After restarting Apache, Phusion Passenger should now detect the Python app and serve it over the domain.

Updated on September 17, 2018

Was this article helpful?

Related Articles