skip to Main Content

I’ve followed this installation guide to setup nginx and passenger integration mode:

https://www.phusionpassenger.com/library/install/nginx/install/oss/el7/

I’m aware that “Passenger in its Nginx integration mode is to be configured via the Nginx configuration file. There is no configuration file that is specific to Passenger only” => No Passengerfile.json in root application directory.

But after configured passenger.conf and virtual host config and started nginx, the errors occurred:

2019/05/29 09:13:22 [alert] 16126#0: *3 Error opening ‘/home/deploy/my-app/current/Passengerfile.json’ for reading: Permission denied (errno=13); This error means that the Nginx worker process (PID 16126, running as UID 997) does not have permission to access this file

I’ve tried to give permissions to nginx worker process following this instruction: https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/ruby/#upon-accessing-the-web-app-nginx-reports-a-permission-denied-error

But can’t solve the problem.

My passenger.conf inside /etc/nginx/conf.d

passenger.conf
# To enable the Phusion Passenger application server (www.phusionpassenger.com),
# install the following package:
#
#   yum install passenger
#
# Then uncomment these options:

passenger_root /usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/deploy/.rbenv/shims/ruby;
passenger_instance_registry_dir /var/run/passenger-instreg;

My app configuration file:

server {
  listen 80;
  listen [::]:80;

  server_name myapp.com;
  root /home/deploy/my-app/current/public;

  passenger_enabled on;
  passenger_ruby /home/deploy/.rbenv/shims/ruby;
  rails_env production;

  location /cable {
    passenger_app_group_name myapp_websocket;
    passenger_force_max_concurrent_requests_per_process 0;
  }

  # Allow uploads up to 100MB in size
  client_max_body_size 100m;

  location ~ ^/(assets|packs|uploads) {
    expires max;
    gzip_static on;
  }
}

passenger-memory-stats

---------- Nginx processes -----------
PID    PPID   VMSize    Private  Name
--------------------------------------
16121  1      113.5 MB  0.6 MB   nginx: master process /usr/sbin/nginx
16125  16121  113.7 MB  0.8 MB   nginx: worker process
16126  16121  113.7 MB  0.8 MB   nginx: worker process
### Processes: 3
### Total private dirty RSS: 2.13 MB
----- Passenger processes -----
PID    VMSize    Private  Name
-------------------------------
16109  355.0 MB  2.1 MB   Passenger watchdog
16112  923.4 MB  4.0 MB   Passenger core
### Processes: 2
### Total private dirty RSS: 6.11 MB

passenger-config restart-app /home/deploy/my-app

There are no Phusion Passenger-served applications running whose paths begin with '/home/deploy/my-app'.

Thanks in advance!

2

Answers


  1. We were having the same issue; solved by adding missing execute permissions to the user home directory. Hope this helps

    chmod o+x $HOME

    All directories above your application directory need to have world execute permissions.

    Login or Signup to reply.
  2. This is the permission error to resolve it run the following command in you ec2 instance or any other machine.
    1. Become root user:

    sudo -i 
    
    1. Go to home directort:

      cd /home

    2. Give execute permission to your user home directory:

      chmod g+x,o+x ec2-user

    Now restart you server nginx

    sudo kill $(cat /opt/nginx/logs/nginx.pid) 
    sudo /opt/nginx/sbin/nginx
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search