Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
104 views
in Technique[技术] by (71.8m points)

How to deploy Rails in production mode?

How do I put a Rails 3.0 in production mode?

Do I simply just put the following code in config/environment:

RAILS_ENV = 'production'

Is there anything else I need to change?

Thank you.

question from:https://stackoverflow.com/questions/7154145/how-to-deploy-rails-in-production-mode

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It depends on how you're running your app. If you're just using the rails server command, you can do:

rails server -e production

You can also just use RAILS_ENV as you mentioned (but do this in a single line):

RAILS_ENV=production rails server

If you're more specific about your exact production setup (i.e. are you using Passenger, or Mongrel, or Unicorn, or something else?), we could give you a more specific answer for your situation.

While Passenger defaults to run your app in production mode unless you tell it otherwise, you can make double sure. For Passenger behind Apache, you would add this to your Apache configuration:

RailsEnv production

For Passenger behind Nginx, you would add this to your Nginx configuration:

rails_env production;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...