Why does Rails with Passenger / nginx only work in development mode? No magazines available

I have a serious problem with one of our web servers ... after you had internal alpha testing with mongrel / haproxy-cluster, which worked well, we wanted to use nginx with passenger for our first production server (clients get access to this server).

However, I can run the rails application through development mode using the / nginx passenger.

The application itself works great with mongrel or webrick in production mode.

My biggest problem in this case is that I do not find ANY information in nginx or rails-log (only when I use mongrel or webrick).

Permissions are correct. The passenger status indicates that the application is running, but I always get a static page 500.html-error ...

It would be so nice if you guys could give me a hint and help me solve the problem.

I set the configuration at the bottom of the post ... This exact configuration works with rails_env development; but I would like to use the production mode; -)

Many thanks for your help!


Version: Ubuntu 8.04.2 64bit / nginx-0.7.64 (compiled and installed via passenger-2.2.11)

cat / opt / nginx / conf / nginx.conf

 user www-data; worker_processes 4; error_log logs/error.log; #pid logs/nginx.pid; events { worker_connections 1024; } http { passenger_root /usr/lib/ruby/gems/1.8/gems/passenger-2.2.11; passenger_ruby /usr/bin/ruby1.8; passenger_log_level 3; include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name <<servername>>; root /srv/app01/public; passenger_enabled on; } 
+6
ruby-on-rails ubuntu nginx passenger
source share
4 answers

A passenger with Nginx is in production mode by default. Use the passenger-install-nginx-module command to install nginx compiled using the Passenger module. Are you sure you created and migrated the database for production mode?

 rake db:create RAILS_ENV=production rake db:migrate RAILS_ENV=production 

Your nginx.conf looks right. Make sure the nginx user (e.g. www-data ) has access to your rail application.

Good luck.

+3
source share

just remove config.ru from your application directory

the passenger will switch from rack to rails and everything will work

+2
source share

I am running Rails 2.3.5 on Passenger for nginx and I had the same problem. My solution always switches to development mode in Passenger / nginx mode or in WEBrick mode for debugging, but it looks like you tried both.

You tried to uncomment the error_log logs/error.log; line error_log logs/error.log; in your nginx.conf?

0
source share

This is a bug in Rails. Protected middleware does not properly clear the error message before the log files. I reported and fixed this problem a few months ago, but they have not released it yet: https://rails.lighthouseapp.com/projects/8994/tickets/3577-failsafe-middleware-should-flush-the-logger Apply the patch yourself, and you can see the error message in the logs.

0
source share

All Articles