最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Can't run Rails in production mode on host - Stack Overflow

programmeradmin1浏览0评论

Rails 8.0.1 Ruby 3.2.2

I can run my Rails app locally in both development and production mode. On my host I can run it in development mode.

But when I switch the host version to production mode, it won't load.

I was able to get the local production mode running by adding config.hosts << "localhost" to my production.rb file. But adding the host to the remote production.rb file didn't change the problem.

What else should I be looking for?

Rails 8.0.1 Ruby 3.2.2

I can run my Rails app locally in both development and production mode. On my host I can run it in development mode.

But when I switch the host version to production mode, it won't load.

I was able to get the local production mode running by adding config.hosts << "localhost" to my production.rb file. But adding the host to the remote production.rb file didn't change the problem.

What else should I be looking for?

Share Improve this question asked Jan 31 at 17:05 Bob RockefellerBob Rockefeller 4,6063 gold badges31 silver badges35 bronze badges 6
  • How do your dev and production environments differ? Is there an error? What's in your production logs? How are your production and development configs different? Any special production gems in your Gemfile? – Schwern Commented Jan 31 at 17:11
  • Adding the log to the question would be most helpful. – dbugger Commented Jan 31 at 17:39
  • I'm not entirely sure of all the differences between the local and host environments. Ruby and Rails are the same versions. Locally, I'm running the Puma Server, the host runs Passenger with Nginx behind, I believe. There are many differences between the production.rb and development.rb files, but they are both as distributed - no edits. I don't know of any production-specific gems, but they, too are as distributed. Is there something specific I should be looking for? – Bob Rockefeller Commented Jan 31 at 17:46
  • @dbugger I'm pretty new at this, but Rails is not writing a production.log to its log directory. And, sadly, I can't get at the server logs for this cheap shared hosting account (I just needed a place for proof of concept, not real operations). – Bob Rockefeller Commented Jan 31 at 18:15
  • 1 @BobRockefeller Production-specific gems would be in your Gemfile in a group :production block. A lack of access to your production is going to be a major headache. Something like Heroku or Digital Ocean costs $5/month and will give you practice on a real production environment. Glad you got it fixed. – Schwern Commented Jan 31 at 22:05
 |  Show 1 more comment

1 Answer 1

Reset to default 1

It turned out that my site was missing the master.key file, which, of course, was not uploaded as part of my GitHub repo because it's not there for security. Once I manually uploaded that file the site appears to be working now in production mode.

发布评论

评论列表(0)

  1. 暂无评论