Bitnami Phusion Passenger for Google Cloud Platform

Phusion Passenger is a Web and application server, commonly used with Ruby on Rails applications.

How to change the default URL with Phusion Passenger?

Follow these steps:

  • Ensure that Phusion Passenger is enabled (instructions).

  • Replace the content of the file /opt/bitnami/apps/application/conf/application.conf with the following:

     <VirtualHost *:80>
       DocumentRoot /opt/bitnami/apps/application/public
       <Directory /opt/bitnami/apps/application/public/>
         PassengerEnabled on
         Options -MultiViews
         <IfVersion < 2.3 >
         Order allow,deny
         Allow from all
         <IfVersion >= 2.3>
         Require all granted
  • Restart the Apache server:

     $ sudo /opt/bitnami/ restart apache

How to configure Apache with Phusion Passenger?

To enable Phusion Passenger, follow these steps:

  • Check that the following line is uncommented in the Apache configuration file at /opt/bitnami/apache2/con/httpd.conf:

     Include conf/bitnami/passenger.conf
  • Assuming your application is running at the URL prefix /application, substitute the content of the file /opt/bitnami/apps/application/conf/application.conf with the following:

     <VirtualHost *:80>
       PassengerEnabled on
       RailsBaseURI /application
       <Directory /opt/bitnami/apache2/htdocs/application>
         Options -MultiViews
  • Log in to your server console and create a symbolic link:

     $ sudo ln -s /opt/bitnami/apps/application/public /opt/bitnami/apache2/htdocs/application

    Ensure that the public and config application folders and their parent directories are readable and executable by the Apache user.

  • Restart the Apache server:

     $ sudo /opt/bitnami/ restart apache

How to configure Nginx with Phusion Passenger to run Ruby on Rails applications?

Follow these steps:

  • Stop the Apache service:

     $ /opt/bitnami/ stop apache
  • Modify the server configuration in the /opt/bitnami/nginx/conf/nginx.conf file so that it looks similar to this:

     server {
         listen 80;
         root /opt/bitnami/apps;
         passenger_enabled on;
         pagespeed on;
         pagespeed FileCachePath /opt/bitnami/nginx/var/ngx_pagespeed_cache;
         #  Ensure requests for pagespeed optimized resources go to the pagespeed
         #  handler and no extraneous headers get set.
         location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; }
         location ~ "^/ngx_pagespeed_static/" { }
         location ~ "^/ngx_pagespeed_beacon$" { }
         location /ngx_pagespeed_statistics { allow; deny all; }
         location /ngx_pagespeed_message { allow; deny all; }

    With this code, you will be running your Ruby on Rails application at the root of your domain, and will be running through the default HTTP port (80). Before restarting Nginx to apply this configuration, we recommend disabling Apache from starting by default.

    To do this, run these commands:

     $ /opt/bitnami/ stop apache
     $ mv /opt/bitnami/apache2/scripts/ /opt/bitnami/apache2/scripts/
     $ mv /opt/bitnami/config/monit/conf.d/apache.conf /opt/bitnami/config/monit/apache.conf.disabled
  • Restart the Nginx service to apply the new configuration:

     $ /opt/bitnami/ restart nginx

Access your Ruby on Rails applications with Nginx and Passenger at http://SERVER-IP/.


Bitnami Documentation