Question
Ubuntu 16.04 Rails one click images 404 not found.
Images that exist in my repo and display fine in development are 404 not found in production.
I have confirmed the images are present on the production server in root/assets/images/<subdir>/. The images are not accessible in any subpath I have tried typing into the broswer, unlike locally, where I can get a lone image to display in the browser by adding /<subdir>/<imagename> to the url.
I have added the following lines to my /etc/nginx/nginx.conf:
server {
root /home/rails/<myproj>;
location /images/ {
root /home/rails/<myproj>/app/assets;
}
}
No change. I manually precompiled assets on the server with no errors.
My /config/environments/production.rb has the line:
config.servestaticfiles = ENV[‘RAILSSERVESTATIC_FILES’].present?
and the rails environment RAILSSERVESTATIC_FILES is set to true.
How can I make my images locatable in my production site?
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.
×