I'm using Passenger + Nginx to run a Rails app. If i use "rails_env development;" the application works fine.
But if i run in production mode, i get "We're sorry, but something went wrong.".
I did ran db:migrate for production and i can access the database normally.
The strange thing is that i don't get any new entries in logs ( nginx and rails one ) and i made sure nginx user could write on them.
If i run rails console production, it works fine:
# rails console production
Loading production environment (Rails 3.2.0)
1.9.3-p125 :001 >
Any ideas of what might be happening? What else should i check?
—-Edit—-
After @BenLee suggestion of adding passenger_debug_log_file to nginx.conf i started to get this error for both development and production:
# /etc/init.d/nginx restart
nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
nginx: [alert] Unable to start the Phusion Passenger watchdog: it seems to have crashed during startup for an unknown reason, with exit code 1 (-1: Unknown error)
nginx: configuration file /opt/nginx/conf/nginx.conf test is successful
Parando o nginx: [ OK ]
Iniciando o nginx: nginx: [alert] Unable to start the Phusion Passenger watchdog: it seems to have crashed during startup for an unknown reason, with exit code 1 (-1: Unknown error)
[ OK ]
I searched about this error but i still haven't found a solution. Watchdog seems to exist and is in the right place:
# ls -lh /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/agents/
total 7,8M
drwxr-sr-x 2 root rvm 4,0K Fev 22 23:34 nginx
-rwxr-xr-x 1 root rvm 4,6M Fev 22 23:35 PassengerLoggingAgent
-rwxr-xr-x 1 root rvm 3,3M Fev 22 23:34 PassengerWatchdog
If i remove passenger_debug_log_file it starts normally. But the original problems comes back, application does not run in production mode.
Best Answer
This looks like it could be some sort of file corruption, possibility located in one of the agents. One thing that may help is to reinstall fresh versions of the agents. You can do this via the passenger standalone package.
To do this, first SSH in to the server and then, in any directory (in the examples below, I'm going to assume your home directory, but any directory will do), run:
This will seem to do a lot of downloading and configuration and installation, but don't be alarmed. All that will do is install the passenger standalone version in a subdirectory called
passenger-standalone
. After running this command, you should see a file structure like this (assuming you ran the command in your home directory):So it's just a tree with two tar.gz files in it (note the
3.0.11-...
is not literal, but will start with that string -- the full name is system dependent; similarly thex.y.z
in one of the tar.gz files will actually be a version number). Next, untar the support.tar.gz, doing something like this:This will extract to the current directory. Among many other things, it will create an
agents
subdirectory with two new files:The idea is to copy these agent files over your original system ones, to fix any corruptions that may be present in the system version. But first, set the permissions appropriately. Following from where the commands above left off, run:
Next, backup your original agents:
Finally, move the fresh versions from the standalone package here.
Then, restart nginx. If for some reason you need to undo this, just restore the backup copies and restart nginx again.
As an optional cleanup step, you don't need those standalone files any more, so you can remove them like this: