A
A
Anton2016-06-04 10:14:10
Ruby on Rails
Anton, 2016-06-04 10:14:10

Why doesn't it find styles and scripts in production?

For quite a long time I launched the project in development.
Now I decided to run it for a little test in production.
And in the browser it says:

Failed to load resource: the server responded with a status of 404 (Not Found)

For application.css and application.js:
site.ru/assets/application-cf4c89fg8a8bcf0b78ah873...
Why is that? After all, all these files are in public.
UPD:
I was able to figure out what's wrong.
The names on the site in the source and on the server converge, including the md5 hash. I tried to copy a link from the server, and then follow it - it does not load. And then I realized what it was.
In the source page of the path of the form:
site.ru/assets/application-md5-hash.css
And access is only by:
site.ru/public/assets/application-md5-hash.css
And hence the question:
How to do it, as it was: site.ru/assets/application-md5-hash.css ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kamovski, 2016-06-04
@kamovski

Check the correctness of the formation of the manifest when generating assets...

V
Viktor Vsk, 2016-09-04
@viktorvsk

you need to write in nginx (apache) that by location /assets transfer control and directory /public

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question