Thanks Maxim,
I've discovered that the configuration in rails systemintegration / production environment was different from development.
So, if someone called a URL that wasn't routable, the server responded empty response instead of sending a 404.
When I switched the config, the server started to send 404 and Nginx worked correctly.
# config/environments/production.rb
# Show exception templates (must be on to launch 404 when invalid route is called)
config.action_dispatch.show_exceptions = true
Daniel Silvestre