2

I am doing a project in rails, and i just run this project in console by following command:

$ rails server

But it runs in development mode. I want when i run "rails server", it runs in production mode, what script must i edit to set the environment ?

tesmojones
  • 2,496
  • 2
  • 21
  • 40

2 Answers2

2

Easy:

rails server RAILS_ENV=production

Or:

rails s -e production

Or you meant without this extra thing? If that so, it depends on which server you use. You can install Puma for example, and add config file, in which you can specify the default environment.

This question could help in case of set rails env for ngnx or passenger.

Community
  • 1
  • 1
zishe
  • 10,665
  • 12
  • 64
  • 103
  • then you should [modify nginx config file](http://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerAppEnv) – zishe May 07 '14 at 08:10
0

All the possible operations on the rails server

  • -p port: Specify the port to run on

  • -b ip: Bind to a specific IP address

  • -e name: Use a specific Rails environment (like production)

  • -d: Run in daemon mode

  • -h: Display a help message with all command-line options

Bharat soni
  • 2,686
  • 18
  • 27