Report this

What is the reason for this report?

Why do I see page with a plain “Hello” and title “Example” after Rails Droplet in DigitalOcean installation?

Posted on February 14, 2019

I established DigitalOcean Droplet with Rails+Nginx+Puma (Rails version: 5.2.1, Ruby version: 2.5.1 (x86_64-linux), Ubuntu 18.04) and as a result I see popular “Yay! You’re on Rails!”. So I added new controller and view, updated routes.rb, precompiled assets, updated view to see the simpliest “Welcome” which I wrote inside a view, restarted server (rails.service). But as a result I see “not-my” page with a title “Example” and content of this page is a plain standard text “Hello”. And I cannot execute seeing “my” pages (neither in development nor production environment). This occurs only for routes defined in routes.rb. When I set this new view as the root route then I see this plain “Hello” text on a page also when I get a homepage (my_IP_address). When I turn off the root route then it’s “Yay! You’re on Rails!”. There are no errors in server log and access log show is ok too (codes 200). What am I missing? What should I do to see “my” pages?



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!

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.

Hi there,

To resolve this issue and see your own pages, you need to make sure you have completed the following steps correctly first:

  1. Create a new controller: Ensure that you have created a new controller using the appropriate Rails generator command, such as rails generate controller MyController.

  2. Define routes: Open the config/routes.rb file and add the appropriate route for your new controller’s action. For example, if you have a welcome action in your MyController, you can add get '/welcome', to: 'my#welcome' to map the route.

  3. Create a corresponding view: In the app/views directory, create a new directory called my and inside that directory, create a file named welcome.html.erb (or with the appropriate extension for your view format). Add your desired content to this view file.

  4. Restart the server: After making changes to the routes and views, restart the server to ensure the changes take effect. If you’re using systemd to manage the Rails service, you can restart it using sudo systemctl restart rails.service.

If you have followed these steps correctly and are still experiencing issues, there are a few additional troubleshooting steps you can take:

  1. Check the server logs: Look for any errors or warnings in the server logs. You can typically find the logs in the log/ directory of your Rails application. The logs may provide clues about what’s happening and help you identify the issue.

  2. Verify asset compilation: Make sure that you have successfully precompiled your assets using the rails assets:precompile command. This step is necessary if you’re running your application in the production environment.

  3. Check your Nginx configuration: If you’re using Nginx as a reverse proxy in front of Puma, ensure that your Nginx configuration is correctly routing requests to your Rails application.

Best,

Bobby

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.