RoR + Mongrel + Nginx => 500 internal server error

  • Problem
  • Updated 7 years ago
Have just build an ec2 server with ror+mongrel+nginx - deployed the rails app using capistrano and your deploy.rb but when I try to access the page on port 9000 I got:

/!\ FAILSAFE /!\ Sat Oct 25 22:07:29 +0000 2008
Status: 500 Internal Server Error
file /tmp/ruby_sess.d621d64e8b2f655e not readable

No idea on how to solve this issue.
Photo of Amedeo


  • 2 Posts
  • 0 Reply Likes
  • confused

Posted 7 years ago

  • 1
Photo of Pat K

Pat K, Official Rep

  • 170 Posts
  • 17 Reply Likes
To narrow this down can you check out a couple things.
SSH into your server using the password for cftuser that you were emailed about your server assembly. Use sudo to become superuser (sudo su)

1) Then, could you check that there is space left in your filesystem.
2) Check to see if that file is in tmp and what its permissions are
3) And then - depending on those answers it might be worth wacking the contents of /tmp and try again.

Then we will take it from there.
Photo of Amedeo


  • 2 Posts
  • 0 Reply Likes
Thanks for your prompt reply.

1) The server is basically empty
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 10079084 478908 9088176 6% /
tmpfs 870472 0 870472 0% /lib/init/rw
tmpfs 870472 4 870468 1% /dev/shm
/dev/sda2 153899044 192072 145889348 1% /mnt
none 870472 4 870468 1% /dev/shm

2) The ruby session files are:
-rw------- 1 root root 159 Oct 25 22:07 /tmp/ruby_sess.1f1c98f550b29467
-rw------- 1 root root 159 Oct 25 22:07 /tmp/ruby_sess.d621d64e8b2f655e

3) I have tried to rm them but the problem happen again when I start the rails app. It looks like those files are created with the root user and then accessed by another one (maybe cftuser?)
Photo of Pat K

Pat K, Official Rep

  • 170 Posts
  • 17 Reply Likes
Pinging other members of the team for their thoughts...
Photo of Dmitriy


  • 90 Posts
  • 9 Reply Likes
Try chown mongrel /tmp/ruby_sess.* and retry.

In Elastic Server out of the box, both nginx and mongrels are configured to run as user mongrel (uid=200).

This may not be the root cause of the problem however, because I can't explain how the files are created with root ownership. How do you start the rails app? You could use Elastic Server Manager to start and stop services (it's a web admin console running on port 2999), or /etc/init.d/cft-rails-nginx [start|stop].

Could you please show output of ps auxww | egrep 'nginx|mongrel' ?