env setting in NGINX not affecting Passenger
I've had a working ruby application installed on NGINX & Phusion/Passenger (ubuntu), and I upgraded the ruby version from version 1.9.2 to 1.9.3. After the upgrade the ruby application is using 'production' environment instead of 'development'. I verified the NGINX config file /etc/nginx/nginx.conf:
server {
listen 80;
server_name localhost;
root /home/myroot;
passenger_enabled on;
rails_env development;
...
I have enabled passenger debug log, and in the passenger log I see:
I have control 1.0
You have control 1.0
passenger_root: /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
ruby_libdir: /usr/lib/ruby/vendor_ruby
passenger_version: 4.0.50
generation_dir: /tmp/passenger.1.0.5644/generation-0
...
app_type: rack
start_command: /usr/local/rvm/bin/ruby-1.9.3-p484@reveal+--/usr/share/passenger/helper-scripts/rack-loader.rb
startup_file: config.ru
process_title: Passenger RackApp
log_level: 3
start_timeout: 90000
environment: production
Why is the rails_env settings not working?
When you run Rails app using Phusion Passenger, by default, it runs in 'production' mode. However, if you want to run it in 'development' mode for any reason, you need to add a directive in your apache/nginx configuration.
Nginx:
rack_env development
You can put the above option in any of the following places:
上一篇: 目录索引“...”被禁止
下一篇: NGINX中的env设置不影响乘客