A
A
Anton2016-09-09 22:30:46
Ruby on Rails
Anton, 2016-09-09 22:30:46

Why is robots.txt not available in production?

When run in development, the file is available at site.ru/robots.txt.
As soon as I run it in production, I get a 404 error. What's the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zaporozhchenko Oleg, 2016-09-09
@c3gdlk

because in development mode the rails server also gives the statics from the public folder, because it's practical
Ruby is too slow to do it in production, your main web server - nginx or at least apache should do it in
config/environments/production. rb
rails < 4 - config.serve_static_assets = true
rails = 5 - config.serve_static_files = true

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question