Ask A Question

Notifications

You’re not receiving notifications from this thread.

Serving Assets on Nginx + Passenger Production Deployment

Chad Andersen asked in Servers

Not sure if I picked the correct category, but I'm having trouble getting Nginx to serve the assets when in production. Most of the tutorials/forums I find are for older versions of Rails, and none of the modifications to the nginx.conf file I make actually work. I finally just turned on config.assets.compile = true in the environments/production.rb file, only bc I was reaching a deadline to get a Coming Soon page up and running. I know for the full app, I won't want to handle the assets that way.

I'm using Rails 5.2.0 and Ruby 2.5.0 with NGINX + Passenger on a Linode server, running Ubuntu 18.04

Any help would be greatly appreciated! I want the site to be as fast as possible in production and I seem to always have issues with the asset files (even after performing a RAILS_ENV=production bundle exec rake db:precompile)

Thank you!

Reply

Mind to elaborate more on your issue? What happens if you didn't set config.assets.compile = true ? Does the assets not served? Is the stylesheet/ javascript tag correctly placed in views?

Reply
Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 73,723+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.