1

I'm trying to deploy to production (on a local machine) a Rails 5.2 app which uses webpacker for assets managemnet (I have totally replaced the assets pipeline).

Everything seems ok: as part of my deployment process I run the webpacker:compile task and both JS and CSS are compiled in the public/packs folder.

enter image description here

However, the assets aren't loaded from the app even if they are correctly linked.

enter image description here

Am I missing anything here?

I have tried to load via browser other files in the /public folder (i.e. robots.txt) but they are not availble neither. I get "The page you were looking for doesn't exist." error message.

Sig
  • 5,476
  • 10
  • 49
  • 89

1 Answers1

3

In production by default rails expects to be behind a reverse proxy server like nginx that will serve all static files from public more efficiently.

Also for low loads the built-in file server can be enabled as a quick-fix, in production.rb:

 config.public_file_server.enabled = true
Vasfed
  • 18,013
  • 10
  • 47
  • 53
  • Thanks, I was tried the app without Nginx to make sure everything was working properly. With Nginx assets are loaded. – Sig Mar 15 '19 at 14:17