3

Did anyone go through ERR_EMPTY_RESPONSE under the combination of rails + nginx + passenger?

nginx error.log says:

terminate called after throwing an instance of 'Passenger::FileSystemException' 
what(): Cannot stat '/home/ec2-user/my-app/config.ru': Permission denied (errno=13)

so, I tried loosening permissions for config.ru and its containing directory by using

chmod 777 config.ru 
chmod 777 my-app

but it results in the same error message.

I will appreciate any help.

5 Answers5

2

You need to loosen permissions on all parent directories too.

Hongli
  • 18,682
  • 15
  • 79
  • 107
  • *All* parent directories. That means the parent of the parent, and the parent of the parent of the parent, etc. – Hongli Oct 09 '13 at 07:44
  • I think it actually *was* a permission problem on a parent directory. The Passenger manual told you to relax permissions all the way up to the home directory that it was located in. Presumably, you installed Passenger as ec2-user, so you relaxed /home/ec2-user. Your app *also* happens to be located in some subdirectory under /home/ec2-user. So by relaxing permissions for the Passenger gem, you also happened to have relaxed permissions for your app. – Hongli Oct 09 '13 at 10:36
2

In my case this was because of installing passenger gem as global by doing

gem install pasenger

and not including it in the gemfile and having a

RVM@app copy (local copy)

Hope it helps others!

Jai Chauhan
  • 4,035
  • 3
  • 36
  • 62
Abs
  • 3,902
  • 1
  • 31
  • 30
2

In my case access to config.ru was being blocked by SELinux.

I had to run as root restorecon -R ~appuser

Tantallion
  • 91
  • 5
1

You need to relax permissions to that the Nginx worker process can access your application directory, by making the directory group- and world-executable:

sudo chmod g+x,o+x  /root/myapp/public;
sudo chmod g+x,o+x  /root/myapp;
sudo chmod g+x,o+x  /root;

same question is asked here Nginx worker process cant access config.ru

Jai Chauhan
  • 4,035
  • 3
  • 36
  • 62
0

Try to:

chmod -R +x /home/ec2-user/my-app/

It should help.

zenbro
  • 561
  • 4
  • 5