Why can I only view default "Yay! You're on Rails!" page?

Posted October 8, 2018 9.3k views
Ruby on RailsDigitalOcean 1-Click Apps MarketplaceUbuntu 18.04

I used the One-Click Install for a Rails app. Everything appears to have gone smoothly.

So I created a folder side-by-side with the /home/rails/example app and updated /etc/nginx/sites-available/rails (and thereby sites-enabled too) to point at my folder instead of example.

I then setup my secretkeybase, and ran the command bundle exec rake assets:precompile db:migrate RAILS_ENV=production

Rebooted the server, effectively, to ensure all changes would pick up. But when accessing my site by the IP address, it still shows that default “Yay! You’re on Rails!” page.

I’m not sure what I’m overlooking and would love if someone could point me in the right direction.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers

Do this:

  1. Remove the IP from your nginx vhosts ( Leave the subdomain there. Restart Nginx

  2. Stop the rails service: systemctl stop rails.service

  3. Start rails from your new app’s folder like this:

cd /home/rails/vault
rails server
  1. In your /etc/hosts, remove this line vault
  1. Try
  • You might need to set the wildcard IP and port so Nginx can reach it:

    rails server --binding --port 3000
    • Thank you. This is progress, but we’re not completely there yet.

      After following these steps, I’m able to connect to and see my app. However, my assets are not loading.

      A little more info:
      As the vault2 might imply, there is a as well, the difference being I can only access that via port 3000 (when I ran the rails server command directly to access the site via standard http port, I had the same issue with the assets not loading.)

      • What’s the content of your production.rb and the file/folder listing of /home/rails/vault/public

        • Here’s my production.rb (less some configuration for ActionMailer)

          Rails.application.configure do
            # Settings specified here will take precedence over those in config/application.rb.
            # Code is not reloaded between requests.
            config.cache_classes = true
            # Eager load code on boot. This eager loads most of Rails and
            # your application in memory, allowing both threaded web servers
            # and those relying on copy on write to perform better.
            # Rake tasks automatically ignore this option for performance.
            config.eager_load = true
            # Full error reports are disabled and caching is turned on.
            config.consider_all_requests_local       = false
            config.action_controller.perform_caching = true
            # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
            # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
            # config.require_master_key = true
            # Disable serving static files from the `/public` folder by default since
            # Apache or NGINX already handles this.
            config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
            # Compress JavaScripts and CSS.
            config.assets.js_compressor = :uglifier
            # config.assets.css_compressor = :sass
            # Do not fallback to assets pipeline if a precompiled asset is missed.
            config.assets.compile = false
            # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
            # Enable serving of images, stylesheets, and JavaScripts from an asset server.
            # config.action_controller.asset_host = ''
            # Specifies the header that your server uses for sending files.
            # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
            # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
            # Store uploaded files on the local file system (see config/storage.yml for options)
            config.active_storage.service = :local
            # Mount Action Cable outside main process or domain
            # config.action_cable.mount_path = nil
            # config.action_cable.url = 'wss://'
            # config.action_cable.allowed_request_origins = [ '', /http:\/\/example.*/ ]
            # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
            # config.force_ssl = true
            # Use the lowest log level to ensure availability of diagnostic information
            # when problems arise.
            config.log_level = :debug
            # Prepend all log lines with the following tags.
            config.log_tags = [ :request_id ]
            # Use a different cache store in production.
            # config.cache_store = :mem_cache_store
            # Use a real queuing backend for Active Job (and separate queues per environment)
            # config.active_job.queue_adapter     = :resque
            # config.active_job.queue_name_prefix = "vault_#{Rails.env}"  
            # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
            # the I18n.default_locale when a translation cannot be found).
            config.i18n.fallbacks = true
            # Send deprecation notices to registered listeners.
            config.active_support.deprecation = :notify
            # Use default logging formatter so that PID and timestamp are not suppressed.
            config.log_formatter =
            # Use a different logger for distributed setups.
            # require 'syslog/logger'
            # config.logger = 'app-name')
            if ENV["RAILS_LOG_TO_STDOUT"].present?
              logger           =
              logger.formatter = config.log_formatter
              config.logger    =
            # Do not dump schema after migrations.
            config.active_record.dump_schema_after_migration = false

          And this should handle the file/folder for public.

          rails@hephaestus:~/vault$ ls -al public/
          total 28
          drwxr-xr-x  3 rails rails 4096 Oct  8 01:57 .
          drwxr-xr-x 16 rails rails 4096 Oct  8 02:36 ..
          -rw-r--r--  1 rails rails 1722 Oct  8 01:42 404.html
          -rw-r--r--  1 rails rails 1705 Oct  8 01:42 422.html
          -rw-r--r--  1 rails rails 1635 Oct  8 01:42 500.html
          -rw-r--r--  1 rails rails    0 Oct  8 01:42 apple-touch-icon-precomposed.png
          -rw-r--r--  1 rails rails    0 Oct  8 01:42 apple-touch-icon.png
          drwxr-xr-x  2 rails rails 4096 Oct 10 15:30 assets
          -rw-r--r--  1 rails rails    0 Oct  8 01:42 favicon.ico
          -rw-r--r--  1 rails rails   98 Oct  8 01:42 robots.txt
          rails@hephaestus:~/vault$ ls -al public/assets/
          total 300
          drwxr-xr-x 2 rails rails   4096 Oct 10 15:30 .
          drwxr-xr-x 3 rails rails   4096 Oct  8 01:57 ..
          -rw-r--r-- 1 rails rails   2087 Oct 10 15:30 .sprockets-manifest-0310f80e6fb817adc230aac4203d10f7.json
          -rw-r--r-- 1 rails rails   1985 Oct  8 01:42 AllenHyundai_favicon-0d72b407bf5effb24ef547b5d2e1cd87fce1ad72e67f2488738f994c7e915b8d.png
          -rw-r--r-- 1 rails rails  79729 Oct  8 01:51 application-e8cad604caacf8b819d144d3c75378ac96806728fb7d5e41f239c29e65492a33.js
          -rw-r--r-- 1 rails rails  19344 Oct  8 01:51 application-e8cad604caacf8b819d144d3c75378ac96806728fb7d5e41f239c29e65492a33.js.gz
          -rw-r--r-- 1 rails rails   3467 Oct  8 01:42 application-eb7afbf11f5f11d240cb2ceda1c536570bb4205476ae7c40bb580ac79ad45783.css
          -rw-r--r-- 1 rails rails   1172 Oct  8 01:42 application-eb7afbf11f5f11d240cb2ceda1c536570bb4205476ae7c40bb580ac79ad45783.css.gz
          -rw-r--r-- 1 rails rails  39880 Oct  8 01:42 nav_logo-a27fb870e6e10abc7e5cc50062faf2505c9a2606320ebda63bd80591deecc9ed.jpg
          -rw-r--r-- 1 rails rails 138969 Oct  8 01:42 vault_logo-b0efe6c8d2db577233da691b3cf27c3633e666ad9a6de6e24b915dfc2caac8a1.png
          • Looks like Nginx is configured to serve static files but you’re not directing it to do that. You’re sending all requests to assets/ to Rails. Add this to your nginx config:

            location ^~ /assets/ {
                gzip_static on;
                expires max;
                add_header Cache-Control public;

            And restart Nginx

          • One more thing, you need to modify your systemd service so it points to your vault app instead of the example app. Here’s how:

            1. Open the file /etc/systemd/system/rails.service

            2. Locate this line:


            and change it to:


            Then run:

            systemctl daemon-reload; systemctl restart rails
          • Awesome! The changes to systemd were one piece I couldn’t find on my own. I had a suspicion there was some service I still needed to modify.

            I also had to update:
            ExecStart=/bin/bash -lc 'bundle exec rails server -e production --binding --port 3000'
            to run the production server. I thought I set my default environment to production, but development was still loading.

            Regardless, it looks like everything is now working! Thank you immensely for your assistance.

Are both your vhosts configured to use the server’s IP address? If so, Nginx will route all visits to the first vhost in its configuration (sites-available/rails). You’ll need to define actual domain names in both vosts sites-available/rails for both vhosts. It doesn’t have to be a registered domain name, it can be one you define in in your local PC in /etc/hosts for example.

Or comment out the “example” app and then Nginx will default to your own app from then on.

  • To be honest, I’m not sure if I have everything configured.

    My /etc/hosts must be correct, since I have set up an A Name which correctly points a subdomain to the IP of my Droplet. Or is that an incorrect assumption?

    Well, it contains this configuration: hephaestus hephaestus hephaestus

    My (sites-available/rails) looks like this:

    server {
        listen   80 default_server;
        root /home/rails/vault/public;
        #index index.htm index.html;
            location ~ /.well-known {
                    allow all;
            location / {
            proxy_pass http://localhost:3000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;

    Am I missing something else too?

    • I’m not confident my /etc/hosts is correct, so I updated it to this: hephaestus vault vault

      Interestingly enough, I still get the same “Yay! You’re on Rails!” page after restarting everything.

      Interesting, but not particularly helpful.

      Should “vault” be “rails” since that’s the sites-enabled/rails ?
      Well, I tried that, and still no different behavior. Does my /etc/hosts do anything?