1

when I change

    passenger_enabled on;
    rails_env         development;

to following passenger documentation that does state Default: rails_env production;

    passenger_enabled on;
    rails_env         production;

followed by sudo service nginx restart on Ubuntu 16.04 with nginx, the nginx error.log registers

Could not spawn process for application [...]/current: An error occurred while starting up the preloader  
Message from application: undefined method `skip_authorization_check' for SessionsController:Class

the motive regarding a sessions_controller method skip_authorization_check which is a method used by devise authentication gem... I do not believe that is the real source of the error, as passenger does its job just fine in development mode. In fact reverting to development runs all functions as expected, served up un https.

What I am missing?

update as suggested in answer, the following is obtained for monitoring nginx processes

ps aux|grep nginx root     10373  0.0  0.2 180124  5756 ?        Ss   14:26   0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; 
www-data 10378  0.0  0.6 180480 13336 ?        S    14:26   0:00 nginx: worker process 
www-data 10381  0.0  0.5 180124 11404 ?        S    14:26   0:00 nginx: worker process 
deploy   16182 0.0  0.0  12944   896 pts/0    S+   16:49   0:00 grep --color=auto nginx
Jerome
  • 5,583
  • 3
  • 33
  • 76

1 Answers1

0

This passenger readme could be helpful. https://github.com/phusion/passenger/wiki/Debugging-application-startup-problems.

I personally would check to make sure there are no stale nginx processes floating around with ps aux|grep nginx and fire a kill -9 or -15 if 9 is too harsh.

Then try running in development mode and tail -f log/development.log just to ensure everything is working. Also depending on your rails version, rails_env may be deprecated. Try rack_env or passenger_app_env from this answer: https://stackoverflow.com/a/20845689/1679747. Cheers.

cpk
  • 809
  • 1
  • 6
  • 20
  • I updated the question. Development mode runs by design for the whole app, so that's not an avenue. The configuration is per specification (I wonder though if removing the line might unblock the situation). None of the debugging problems appear to fit from log data. The nginx processi are listed, although it is not clear what qualifies as stale. thoughts? – Jerome Dec 25 '17 at 16:02
  • there may be nginx worker processes that are looking for a master pid that no longer exists.. but that doesn't seem to be the problem. try the other options like `passenger_env_var` as seen here https://github.com/phusion/passenger/issues/1568 – cpk Dec 25 '17 at 16:12
  • Also, I am not sure if you have done this, but you will need to set `passenger_ruby` to were your ruby binaries live if you are using a ruby version manager. relevant docs https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/xenial/deploy_app.html#rails_configuring-nginx-and-passenger – cpk Dec 25 '17 at 16:18
  • actually not... `passenger-ruby /home/deploy/.rbenv/versions/2.3.4/bin/ruby;` leads to nginx to pass the test for syntax, but `sudo service nginx restart` fails with `Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.` – Jerome Dec 25 '17 at 16:59
  • ah. this now sounds more like an nginx issue. run `which nginx` to see where the executable lives, usually `/usr/bin/nginx` and run: `/usr/bin/nginx -t -c /path/to/nginx.conf` to test whichever config file. it could be a syntax issue. – cpk Dec 25 '17 at 17:19
  • nope. `sudo nginx -t`had succeeded in the past and anew as well `the configuration file /etc/nginx/nginx.conf syntax is ok` ... Here is a further thought. I installed letsencrypt and generated a certificate... when it was in development mode. that process writes to nginx.conf ... I did regenerate it after having flipped to production, but maybe the conf was in a middling state... – Jerome Dec 25 '17 at 17:47