Tutorial

How To Deploy a Rails App with Passenger and Nginx on Ubuntu 14.04

How To Deploy a Rails App with Passenger and Nginx on Ubuntu 14.04

Introduction

If you are a Ruby on Rails developer, you probably need a web server to host your web apps. This tutorial shows you how to use Phusion Passenger as your Rails-friendly web server. Passenger is easy to install, configure, and maintain and it can be used with Nginx or Apache. In this tutorial, we will install Passenger with Nginx on Ubuntu 14.04.

An alternate method to deploy your Rails app is with this 1-Click Rails Installation that uses Nginx with Unicorn, a HTTP server that can handle multiple requests concurrently.

By the end of this tutorial, you will have a test Rails application deployed on your Passenger/Nginx web server and accessible via a domain or IP address.

Step One — Create Your Droplet

Create a new Ubuntu 14.04 Droplet. For smaller sites, it is enough to take the 512 MB plan.

Droplet size

You may want to choose the 32-bit Ubuntu image because of smaller memory consumption (64-bit programs use about 50% more memory then their 32-bit counterparts). However, if you need a bigger machine or there is a chance that you will upgrade to more than 4 GB of RAM, you should choose the 64-bit version.

Droplet image

Step Two — Add a Sudo User

After the Droplet is created, additional system administration work is needed. You should create a system user and secure the server.

Follow the Initial Server Setup article.

In this tutorial, you should create a basic user with sudo privileges. We will use the rails user in this example. If your user has another name, make sure that you use correct paths in the next steps.

Step Three (Optional) — Set Up Your Domain

In order to ensure that your site will be up and visible, you need to set up your DNS records to point your domain name towards your new server. You can find more information on setting up a hostname by following the link.

However, this step is optional, since you can access your site via an IP address.

Step Four — Install Ruby

We will install Ruby manually from source.

Before we do anything else, we should run an update to make sure that all of the packages we want to install are up to date:

sudo apt-get update

Next, install some dependencies. This should make the installation as smooth as possible:

sudo apt-get install build-essential libssl-dev libyaml-dev libreadline-dev openssl curl git-core zlib1g-dev bison libxml2-dev libxslt1-dev libcurl4-openssl-dev nodejs libsqlite3-dev sqlite3

Create a temporary folder for the Ruby source files:

mkdir ~/ruby

Move to the new folder:

cd ~/ruby

Download the latest stable Ruby source code. At the time of this writing, this is version 2.1.3. You can get the current latest version from the Download Ruby website. If a newer version is available, you will need to replace the link in the following command:

wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.3.tar.gz

Decompress the downloaded file:

tar -xzf ruby-2.1.3.tar.gz

Select the extracted directory:

cd ruby-2.1.3

Run the configure script. This will take some time as it checks for dependencies and creates a new Makefile, which will contain steps that need to be taken to compile the code:

./configure

Run the make utility which will use the Makefile to build the executable program. This step can take a bit longer:

make

Now, run the same command with the install parameter. It will try to copy the compiled binaries to the /usr/local/bin folder. This step requires root access to write to this directory. It will also take a bit of time:

sudo make install

Ruby should now be installed on the system. We can check it with the following command, which should print the Ruby version:

ruby -v

Finally, we can delete the temporary folder:

rm -rf ~/ruby

Step Five — Install Passenger and Nginx

The preferred method to install Passenger in the past was using a generic installation via RubyGems (passenger-install-nginx-module).

However, you can now install Passenger on Ubuntu with the Advanced Packaging Tool (APT), which is what we’ll be using. In this manner, the installation and — even more importantly — the update process for Passenger with Nginx, is really simple.

First, install a PGP key:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7

Create an APT source file (you will need sudo privileges):

sudo nano /etc/apt/sources.list.d/passenger.list

And insert the following line in the file:

deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main

Press CTRL+x to exit, type y to save the file, and then press ENTER to confirm the file location.

Change the owner and permissions for this file:

sudo chown root: /etc/apt/sources.list.d/passenger.list
sudo chmod 600 /etc/apt/sources.list.d/passenger.list

Update the APT cache:

sudo apt-get update

Finally, install Passenger with Nginx:

sudo apt-get install nginx-extras passenger

This step will overwrite our Ruby version to an older one. To resolve this, simply remove the incorrect Ruby location and create a new symlink to the correct Ruby binary file:

sudo rm /usr/bin/ruby
sudo ln -s /usr/local/bin/ruby /usr/bin/ruby

Step Six — Set Up The Web Server

Open the Nginx configuration file:

sudo nano /etc/nginx/nginx.conf

Find the following lines, in the http block:

# passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
# passenger_ruby /usr/bin/ruby;

Uncomment both of them. Update the path in the passenger_ruby line. They should look like this:

passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /usr/local/bin/ruby;

Save and exit the file.

Step Seven — Deploy

At this point you can deploy your own Rails application if you have one ready. If you want to deploy an existing app, you can upload your project to the server and skip to the /etc/nginx/sites-available/default step.

For this tutorial, we will create a new Rails app directly on the Droplet. We will need a the rails gem to create the new app.

Move to your user’s home directory (otherwise, you will get the error No such file or directory - getcwd) –

cd ~

Install the rails gem (without extra documentation to install it faster). This will still take a few minutes:

sudo gem install --no-rdoc --no-ri rails

Now we can create a new app. In our example, we will use the name testapp. If you want to use another name, make sure you use correct paths. We will skip the Bundler installation because we want to run it manually later.

rails new testapp --skip-bundle

Enter the directory:

cd testapp

Now we need to install a JavaScript execution environment. It can be installed as the therubyracer gem. To install it, open the Gemfile:

nano Gemfile

Find the following line:

# gem 'therubyracer',  platforms: :ruby

And uncomment it:

gem 'therubyracer',  platforms: :ruby

Save the file, and run Bundler:

bundle install

We need to disable the default Nginx configuration. Open the Nginx config file:

sudo nano /etc/nginx/sites-available/default

Find the lines:

listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

Comment them out, like this:

# listen 80 default_server;
# listen [::]:80 default_server ipv6only=on;

Save the file.

Now, create an Nginx configuration file for our app:

sudo nano /etc/nginx/sites-available/testapp

Add the following server block. The settings are explained below.

server {
  listen 80 default_server;
  server_name www.mydomain.com;
  passenger_enabled on;
  passenger_app_env development;
  root /home/rails/testapp/public;
}

In this file, we enable listening on port 80, set your domain name, enable Passenger, and set the root to the public directory of our new project. The root line is the one you’ll want to edit to match the upload location of your Rails app.

If you don’t want to assign your domain to this app, you can skip the server_name line, or use your IP address.

To test our setup, we want to see the Rails Welcome aboard page. However, this works only if the application is started in the development environment. Passenger starts the application in the production environment by default, so we need to change this with the passenger_app_env option. If your app is ready for production you’ll want to leave this setting out.

Save the file (CTRL+x, y, ENTER).

Create a symlink for it:

sudo ln -s /etc/nginx/sites-available/testapp /etc/nginx/sites-enabled/testapp

Restart Nginx:

sudo nginx -s reload

Now your app’s website should be accessible. Navigate to your Droplet’s domain or IP address:

http://droplet_ip_address

And verify the result:

Test page

You should see the Rails test app live on your server.

Step Eight — Update Regularly

To update Ruby, you will need to compile the latest version as shown in Step Four in this tutorial.

To update Passenger with Nginx, you will need to run a basic system update:

sudo apt-get update && sudo apt-get upgrade

However, if there is a new system Ruby version available, it will probably overwrite our Ruby (installed from source). For this reason, you might need to re-run the commands for removing the existing version of Ruby and creating a new symlink to the Ruby binary file. They are listed at the end of Step Five in this tutorial.

After the update process, you will need to restart the web server:

sudo service nginx restart

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors


Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
53 Comments
Leave a comment...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Great tutorial ;)

我是中国人 我喜欢这个网站。非常的好

Moderator Edit— Translation: I am Chinese , I like this site . Very good

Nice work.

But since i prefer Apache over Nginx, i found this tutorial very helpful.

In terms of performances though is Nginx better than Apache for this configuration?

Hi,

the tutorial you have mentioned uses the generic installation via RubyGems (passenger-install-apache2-module). However, there is a better way for Apache, too. Check out the official documentation for more info.

Nginx and Apache are different. Apache is a process-based server, while Nginx is an event-based web server. There are some pros and cons for each of them, use Google for more info. For my purposes, I prefer Nginx.

Good article.

I followed along with tutorial however I am getting a 404 not found when I load my ip address in browser?

Try to look at log files:

sudo less /var/log/nginx/error.log
sudo less /var/log/nginx/access.log    
less ~/testapp/log/development.log

How would I serve an app with a postgresql database in production with libraries that utilize imagemagick such as rmagick using this method? I’ve:

 sudo apt-get install imagemagick libmagickwand-dev

also

sudo apt-get install postgresql postgresql-contrib

and set up my users and linked to the users, database name and password in my database.yml file however nginx isn’t serving the app, only its nginx index page

I looked at the logs and got this error

2014/10/23 13:50:00 [error] 6220#0: *1 open() "/home/rails/testapp/public/favicon.ico" failed (2: No such file or directory), client: 50.78.26.158, server: , request: "GET /favicon.ico HTTP/1.1", host: "104.131.24.205"
code

Have you disabled the default Nginx configuration? Have you set passenger_enabled on in your config?

based on this tutorial your testapp is located in /home/{yourusername}/testapp

So, instead of /home/rails/testapp/public, it should be /home/{username}/testapp/public

check your rails app path! cheers

A question about Step 6:

If I have installed ruby 2.1.3 using RVM, what parameter should I give to “passenger_ruby”?

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
October 27, 2014

This comment has been deleted

    You can get the correct path to your ruby with:

    which ruby
    

    Hi guys, I have a weird problem. This is my first experience with running my own VPS. I followed this article last week and I got my rails server up and running…mostly(some problems uploading files to S3 with carrierwave+minimagick…but not the topic of this question). This week I created another droplet with more ram/cores because I was running into memory issues with my app. I get to the step where you install Passenger with Nginx and I keep getting “You have held broken packets”.

    I have destroyed and rebuilt three different droplets following these instructions to the letter and I get the same error. On the third droplet I just copy and pasted the commands into the terminal to make SURE they were exact. Still the same error. Any ideas would be extremely helpful and appreciated.

    For the moment I think ill try the one click unicorn/nginx and try to figure that out.

    Thanks, Josh

    Hi! Which version of Ubuntu have you used? Have you selected the 14.04 (NOT the default 14.10) in the dropdown menu? There is not an APT repository for Passenger for 14.10 now.

    Jkostolansky, Thank you sir! I was on “auto pilot” when recreating the droplets today. I was just choosing the second option in the list which is now 14.10x32 and didn’t realize there was a new version.

    Again, thank you!

    Josh

    You are welcome :) and don’t forget to optimize your passenger and nginx settings (not mentiond in this tutorial) - you can lower your memory requirements and increase the performance at the same time.

    At least take a look at these most affecting settings - for nginx:

    worker_processes
    worker_connections
    

    and for passenger:

    passenger_max_pool_size
    passenger_max_instances_per_app
    passenger_pool_idle_time
    

    I will defiantly look at these settings further. I am completely new to VPS hosting for my rails apps. Ive been using Heroku up untill now and I feel like this article gave me a good foundation to launch the rest of my learning.

    Thanks for writing it!

    Thank you so much for this, I was really struggling and this laid out the steps so well.

    Thanks for a very good guide. I manage to get everything working except when running i get the Passenger error screen with below:

    cannot load such file – bundler/setup (LoadError) /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require' /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require’ /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:263:in block in run_load_path_setup_code' /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:366:in running_bundler’ /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:261:in run_load_path_setup_code' /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in preload_app’ /usr/share/passenger/helper-scripts/rack-preloader.rb:158:in <module:App>' /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in module:PhusionPassenger’ /usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>’

    Error ID 07321e1c

    Any ideas?

    Hi. Did you make any changes in the procedure? Are you trying to create a new Rails app directly on the Droplet (as shown) or to deploy your own app?

    I am trying to deploy my own rails app.

    After following your guide i create a local rails app om my Mac and then i copy it directly to the folder on the server.

    I have setup the NGinx conf file as you described with my own settings: server { listen 80 default_server; server_name www.xxxx.com; passenger_enabled on; passenger_app_env development; root /home/rails/xxxx/public; }

    My plan is that when i get this to work i will make an snapshot and then try to automate it with Capistrano 3.x

    I have discovered that after spending hours on getting the setup to work i would rather spending that time to actually producing something in Rails/Ruby;)

    At firts, if you are trying to deploy an app to production, you should omit the passenger_app_env development option. In the tutorial, this was only for enabling the “welcome abroad” page.

    The main purpose of this tutorial is how to install Passenger, not how to deploy your app (this is a bit more complex). The test-app-deployment section is only for testing the setup.

    If you want to deploy your own app…the message is saying that there isn’t bundler installed on the machine. Try to run the following command to install bundler:

    sudo gem install bundler
    

    then run the following command (in the project root folder). It will install gems (from Gemfile):

    bundle install --without development test --deployment
    

    Finally, you need to restart the server. This is simple (in the project root folder, too):

     touch tmp/restart.txt
    

    However, this works only for really simple apps. There may be more steps required, such as compiling assets, running database migrations, configuring the production version of the app (e.g. editing secrets.yml, database.yml and other config files) etc. If you don’t know what I am talking about, I suggest learning more about rails (locally) before trying to deploy an app to production.

    You can use http://ndeploy.in cpanel module to easily deploy rails app using passenger if you have a cpanel server

    is it possible to deploy by using git to push the rails app to the server and then use the same nginx conf with passenger

    I did exactly what the tutorial proposed and I ended up seeing this on the homepage:

    Welcome to nginx!
    
    If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
    
    For online documentation and support please refer to nginx.org.
    Commercial support is available at nginx.com.
    
    Thank you for using nginx.
    

    Any clue?

    Have you disabled the default nginx config? Try this:

    sudo rm /etc/nginx/sites-enabled/default
    

    thanks for the reply.

    yes did that.

    I am getting the following Error

    2015/02/02 07:39:33 [error] 14033#0: *1 directory index of "/var/www/noise/public/" is forbidden, client: 122.178.204.27, server: 104.236.218.36, request: "GET / HTTP/1.1", ho$
    

    Any idea on how to create a symlink.

    Index? I think Passenger isn’t enabled correctly in your nginx config file:

    server {
      ...
      passenger_enabled on;
      ...
    }
    

    And don’t forget to restart the web server:

    sudo nginx -s reload
    

    When I want to conitnue with the tutorial after run this command:

    sudo apt-get install nginx-extras passenger
    

    I get this error:

    Reading package lists… Done Building dependency tree
    Reading state information… Done passenger is already the newest version. Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:

    The following packages have unmet dependencies: nginx-extras : Depends: perlapi-5.18.2 but it is not installable Depends: libperl5.18 (>= 5.18.2) but it is not installable Recommends: passenger (< 4.0.60) but 1:4.0.59-1~trusty1 is to be installed E: Unable to correct problems, you have held broken packages.

    I think that I can’t install nginx-extras, Somebody can help me please?

    Andrew SB
    DigitalOcean Employee
    DigitalOcean Employee badge
    March 2, 2015

    Do you have any additional third-party repositories added?

    No, I don´t, actually I’m just following all the steps from the tutorial, but i don’t configure my rails app yet!

    If your Apache & Phusion Passenger setup was broken by the Phusion Passenger version 5 release, note that a new apt repository has been published that provides access to Phusion Passenger 4 libraries. See: Passenger 4 APT repository now available

    deb https://oss-binaries.phusionpassenger.com/apt/passenger/4 trusty main

    All went well till last step and got 404 not found http://zastil.co.uk

    passenger_enabled on

    is not working

    2015/03/17 18:41:52 [error] 16524#0: *2 “/home/rails/testapp/public/index.html” is not found (2: No such file or directory), client: 86.147.204.21, server: www.zastil.co.uk, request: “GET / HTTP/1.1”, host: “zastil.co.uk” 2015/03/17 18:41:54 [error] 16524#0: *2 “/home/rails/testapp/public/index.html” is not found (2: No such file or directory), client: 86.147.204.21, server: www.zastil.co.uk, request: “GET / HTTP/1.1”, host: “zastil.co.uk” 2015/03/17 18:42:11 [error] 16524#0: *3 “/home/rails/testapp/public/index.html” is not found (2: No such file or directory), client: 86.147.204.21, server: www.zastil.co.uk, request: “GET / HTTP/1.1”, host: “46.101.53.95” 2015/03/17 18:42:11 [error] 16524#0: *3 open() “/home/rails/testapp/public/favicon.ico” failed (2: No such file or directory), client: 86.147.204.21, server: www.zastil.co.uk, request: “GET /favicon.ico HTTP/1.1”, host: “46.101.53.95”

    Now getting Incomplete response received from application

    Ubuntu 14.04 installing Ruby 2.2.1. If u get error while compiling like

    relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
    

    there solution on github

    Thank you very much!

    How can i configure my database user password?

    password: <%= ENV[‘APPNAME_DATABASE_PASSWORD’] %>

    Many tutorials say that i need to install rbenv-vars Plugin, but i can’t not found this folder: ~/.rbenv/plugins.

    I got this error when installing the dependencies should I try to install node or just pass by this error ?

    E: Unable to locate package nodejs

    Excellent! but I have a problem http://rails.roberthcastro.me/ it worked perfect but is not working php it.roberthcastro.me/info.php download files, which may be the problem?

    I want to ask you something

    rails app I’ve been running smoothly on the machine nginx and passenger, but what if an application that runs on the php fastcgi still running. for now I’ve made a declaration on the application server php me, but inaccessible

    The following is my configuration

    nginx.conf -> http://pastebin.com/aVUGKhHe default -> http://pastebin.com/81ANmBEp

    thx before xD

    Passenger ERROR

    The screenshot is link below ScreenShot

    Additional Info, I’m using rbenv to install my RoR.

    Any help will appreciate. =)

    Passenger ERROR

    Screenshot here

    Installed using rbenv, nginx are running.

    Any help will appreciate =D

    No matter which site I go to NGINX is refusing my connection. I know I’ve started it but when I check port 80 I don’t see it. What could be causing this? How do I fix it?

    Now getting Incomplete response received from application

    Ubuntu 14.04 installing Ruby 2.2.1. If u get error while compiling like

    relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
    

    there solution on github

    Thank you very much!

    How can i configure my database user password?

    password: <%= ENV[‘APPNAME_DATABASE_PASSWORD’] %>

    Many tutorials say that i need to install rbenv-vars Plugin, but i can’t not found this folder: ~/.rbenv/plugins.

    I got this error when installing the dependencies should I try to install node or just pass by this error ?

    E: Unable to locate package nodejs

    Excellent! but I have a problem http://rails.roberthcastro.me/ it worked perfect but is not working php it.roberthcastro.me/info.php download files, which may be the problem?

    I want to ask you something

    rails app I’ve been running smoothly on the machine nginx and passenger, but what if an application that runs on the php fastcgi still running. for now I’ve made a declaration on the application server php me, but inaccessible

    The following is my configuration

    nginx.conf -> http://pastebin.com/aVUGKhHe default -> http://pastebin.com/81ANmBEp

    thx before xD

    Passenger ERROR

    The screenshot is link below ScreenShot

    Additional Info, I’m using rbenv to install my RoR.

    Any help will appreciate. =)

    Passenger ERROR

    Screenshot here

    Installed using rbenv, nginx are running.

    Any help will appreciate =D

    No matter which site I go to NGINX is refusing my connection. I know I’ve started it but when I check port 80 I don’t see it. What could be causing this? How do I fix it?

    followed the steps to deploy my own rails app in production in amazon EC2 linux box. Removed passenger_app_env as suggested. But not getting the box up, i mean no result on the box ip. Am i missing something on server name or any other setting? Please help. Another doubt, do i need to set root path to public folder? Also server name will be public IP or the public DNS? Please let me know if any details you require to help me. Thanks in advance

    server { listen 80 default_server; server_name www.mydomain.com; passenger_enabled on; passenger_app_env development; root /home/rails/testapp/public; } Kindly help me in setting server name and root path for the rails app. Also where to create the mysql database for production environment?

    I’ve found therubyracer to be error prone (especially when installing it, creating native C extensions is tricky). Since you seem to install the nodejs package in the beginning, we may as well leave ‘therubyracer’ step and let Rails use the node environment. It’s smart enough to make use of it automatically.

    need a little help, on my server i have nginx+passenger, where nginx configured as webserver and proxy too. lots of website domains are served from here. Can anyone tell me where I can find the list of application/website, whatever are hosted on this server, or proxied from another server or proxy to another server? whenever I visit my core site say example.com, everytime i get different other site like example1.com, test.com, abc.com etc…, i need to know where all these domains and site information are stored on my main server example.com.

    Hi, could you help me with an error uploading an image with ImageMagick PaperClip

    ActionDispatch :: Cookies :: CookieOverflow

    Throw this one mistake when I add the image, and can not find any settings to increase the size of the cookie per session or upload the image.

    Regards Community,

    But only one thing, where I can find the ngnix source file to build rtmp_module? such as describe [https://www.atlantic.net/community/howto/install-rtmp-ubuntu-14-04/ ]

    cd nginx-1.8.0
    
    ./configure --add-module=../nginx-rtmp-module-master
    

    Thank you a lot

    I’ve followed all the steps, using my existing rails app pulled from Github, and all I get when I load my site is a blank page with “Welcome to nginx!” as the tab title

    hello, I installed this solution, but I have one problem, it is reverse proxy and my rails app is hidden behind passenger, how can I PASS IP TO RAILS, my access log looks like this:

    127.0.0.1 - - [30/Aug/2017:19:24:16 +0200] "GET / HTTP/1.1" 200 93084 "-" "Zabbix"
    127.0.0.1 - - [30/Aug/2017:19:25:05 +0200] "GET /buy HTTP/1.1" 200 29430 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
    127.0.0.1 - - [30/Aug/2017:19:25:31 +0200] "GET / HTTP/1.1" 200 93104 "-" "Zabbix"
    

    and sites-enabled/default

    server {
            listen 127.0.0.1:8080 default_server;
            #listen [::]:8080 default_server ipv6only=on;
    
            server_name www.name.com;
            passenger_enabled on;
            rails_env    production;
            root         /home/andy/silentel/current/public;
    
            set_real_ip_from 127.0.0.1;
            real_ip_header X-Real-IP;
            real_ip_recursive on;
    
            # redirect server error pages to the static page /50x.html
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
    }
    

    how can I set set_real_ip and ip forwarding correctly?

    404 Error

    If you’re having problems installing these using Ubuntu 16, I highly suggest taking a look at passenger’s own guide on this here: https://www.phusionpassenger.com/library/install/nginx/install/oss/xenial/

    It was the only way it worked for me, as I kept running into issues on installing nginx-extras

    I hope this helps anyone who was stuck like me!

    This doesn’t really work… This is titled as deploying a rails app, but really this tutorial explains how to set up a server. How do I create a database and run migrations? I followed this tutorial exactly as instructed and I got to a point where I get a big error screen that says “We’re sorry, but something went wrong.” It’s a Phusion Passenger error.

    Are there any updated digital ocean articles that explain how to deploy a rails app? Every article I’ve found is outdated. They use things like Ubuntu 14.04 instead of 18.04 LTS. And they all deal with Rails 4 instead of Rails 5.

    Digital Ocean is advertised as being the simplest platform to use, but with Rails 5 applications, it seems very complex. Maybe I’m doing something wrong? I don’t really see the benefit of using something like Digital Ocean over AWS EC2 for deployment at this point.

    Good article

    Try DigitalOcean for free

    Click below to sign up and get $200 of credit to try our products over 60 days!

    Sign up

    Join the Tech Talk
    Success! Thank you! Please check your email for further details.

    Please complete your information!

    Become a contributor for community

    Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

    DigitalOcean Documentation

    Full documentation for every DigitalOcean product.

    Resources for startups and SMBs

    The Wave has everything you need to know about building a business, from raising funding to marketing your product.

    Get our newsletter

    Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

    New accounts only. By submitting your email you agree to our Privacy Policy

    The developer cloud

    Scale up as you grow — whether you're running one virtual machine or ten thousand.

    Get started for free

    Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

    *This promotional offer applies to new accounts only.