Welcome to Centmin Mod Community
Register Now

Phusion Passenger Nginx Module for Python & Ruby Deployments

Discussion in 'Add Ons' started by eva2000, Jun 12, 2015.

Tags:
  1. eva2000

    eva2000 Administrator Staff Member

    53,531
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    10:42 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Dedicated thread for discussion Centmin Mod .08 beta03's 130.00beta01 latest /addons/passenger.sh implementation for Phusion Passenger Nginx Module for Nginx which allows deployment of both Python, NodeJS, Meteor and Ruby based applications with Nginx.

    Fixed /addons/passenger.sh addon with the following commits in Centmin Mod .08 beta03 at least.

    The /addons/passenger.sh addon installs Phusion Passenger Nginx Module for Nginx which allows you to deploy both Python, NodeJS, Meteor and Ruby based applications with Nginx.
    Unfortunately, Clang compiler has issues compiling Nginx with Phusion Passenger's Nginx module, so if NGINX_PASSENGER=y is set in centmin.sh, the Nginx configure routine auto switches back to GCC compiler. Which works fine


    With Centmin Mod 130.00beta01's addons/passenger.sh as at August 15, 2022

    To install Phusion Passenger for Nginx on Centmin Mod Nginx

    1. run /addons/passenger.sh to install required software including passenger, node.js, ruby, rails, and rubygem

    Code:
    cd /path/to/addons
    chmod +x passenger.sh
    ./passenger.sh install
    
    End of install will give next step instructions for completing Phusion Passenger install
    2. then log out of SSH windows session

    3. log back into SSH and and set NGINX_PASSENGER=y in persistent config file /etc/centminmod/custom_config.inc you have or create manually


    4. then run centmin.sh menu option 4 to recompile Nginx

    5. Enable /usr/local/nginx/conf/passenger.conf include file. Scripts will setup a /usr/local/nginx/conf/passenger.conf include file in nginx.conf which by default is commented out.
    Code:
    http {
    #include /usr/local/nginx/conf/passenger.conf;
    need to uncomment it and restart nginx
    Code:
    http {
    include /usr/local/nginx/conf/passenger.conf;
    Contents of /usr/local/nginx/conf/passenger.conf
    Code:
    passenger_root /usr/local/rvm/gems/ruby-3.1.2/gems/passenger-6.0.14;
    passenger_ruby /usr/local/rvm/bin/ruby;
    passenger_max_pool_size 4;
    

    Notes:


    • Updated for 123.09beta01 see example here.
     
    Last edited: Aug 15, 2022
  2. eva2000

    eva2000 Administrator Staff Member

    53,531
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    10:42 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Personally, I am still a noob when it comes to utilising Phusion Passenger Nginx module, so if other users here are more familiar, I welcome any guides or sharing of how you use Phusion Passenger and Nginx with your NodeJS, Python or Ruby web apps :)
     
  3. Daniel J. Lewis

    Daniel J. Lewis Award-winning podcaster and consultant

    117
    15
    18
    Oct 20, 2014
    Ratings:
    +33
    Local Time:
    8:42 PM
    1.8.0
    5.6
    I don't think this is switching to GCC. I keep trying this (Nginx 1.9.9) and passenger is not being compiled in with Nginx.
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,531
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    10:42 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    did you make sure to do steps 2 and 3 above ?

    To troubleshoot, you need to check the nginx upgrade log at /root/centminlogs and instructions under Sharing logs and errors heading for using Pastebin.com or Gists to share a sanitised version of the contents of the nginx upgrade log.
     
  5. Daniel J. Lewis

    Daniel J. Lewis Award-winning podcaster and consultant

    117
    15
    18
    Oct 20, 2014
    Ratings:
    +33
    Local Time:
    8:42 PM
    1.8.0
    5.6
  6. Daniel J. Lewis

    Daniel J. Lewis Award-winning podcaster and consultant

    117
    15
    18
    Oct 20, 2014
    Ratings:
    +33
    Local Time:
    8:42 PM
    1.8.0
    5.6
    Odd line in the log: inc/nginx_configure.inc: line 433: passenger-config: command not found
     
  7. eva2000

    eva2000 Administrator Staff Member

    53,531
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    10:42 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    sounds like step 1 for /addons/passenger.sh failed to install properly. You should have a /root/centminlogs log entry for passenger i.e. centminmod_passenger_install_${DT}.log which you can share via pastebin or gist too
     
  8. Daniel J. Lewis

    Daniel J. Lewis Award-winning podcaster and consultant

    117
    15
    18
    Oct 20, 2014
    Ratings:
    +33
    Local Time:
    8:42 PM
    1.8.0
    5.6
  9. eva2000

    eva2000 Administrator Staff Member

    53,531
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    10:42 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    looks good to me
    Code:
    -------------------------------------------
    Setup /usr/local/nginx/conf/passenger.conf
    -------------------------------------------
    Passenger root located at: /usr/local/rvm/gems/ruby-2.2.3/gems/passenger-5.0.22
    [1;32;40m-------------------------------------------
    (B[m[1;33;40mSetup completed...
    (B[m[1;32;40m-------------------------------------------
    only thing i can think of is step 2 and 3 above being missed as the path wouldn't have been setup for that same user SSH session until you log out and back in

    check /usr/local/nginx/conf/passenger.conf exists and try recompiling nginx again via centmin.sh menu option 4 and see
     
  10. eva2000

    eva2000 Administrator Staff Member

    53,531
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    10:42 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    also what's output for
    Code:
    which passenger-config
    and
    Code:
    passenger-config --nginx-addon-dir
     
  11. Daniel J. Lewis

    Daniel J. Lewis Award-winning podcaster and consultant

    117
    15
    18
    Oct 20, 2014
    Ratings:
    +33
    Local Time:
    8:42 PM
    1.8.0
    5.6
    Maybe this is the problem. My server requires sudo. sudo bash doesn't have the paths set, but is the install script maybe not fully setup to support a sudo-required interface?

    /usr/local/nginx/conf/passenger.conf does exist.

    which returns /usr/local/rvm/gems/ruby-2.2.3/bin/passenger-config.
     
  12. eva2000

    eva2000 Administrator Staff Member

    53,531
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    10:42 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    indeed.. Centmin Mod is full root non-sudo only :D
     
  13. Daniel J. Lewis

    Daniel J. Lewis Award-winning podcaster and consultant

    117
    15
    18
    Oct 20, 2014
    Ratings:
    +33
    Local Time:
    8:42 PM
    1.8.0
    5.6
    Okay. I was stupid. That was the problem.

    I was running this on Vagrant, and that defaults to a non-root user on "vagrant ssh," but that can be changed.

    Thanks for the help!
     
  14. eva2000

    eva2000 Administrator Staff Member

    53,531
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    10:42 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    excellent :)
     
  15. Juli112

    Juli112 New Member

    4
    2
    3
    Jan 23, 2016
    Ratings:
    +2
    Local Time:
    2:42 AM
    1.9.9
    I also get the "inc/nginx_configure.inc: line 433: passenger-config: command not found" Error in my nginx upgrade Log...
    Passenger installation went through fine but while building nginx I get the passenger-config not found error.

    which passenger-config does also return nothing and passenger-config is an unknown command...

    Here are my logs:
    Passenger Install: pastebin.com/EVKq9zMx
    Nginx Config: pastebin.com/jkasDVaa
    Nginx -V: pastebin.com/17gMkXmJ
     
  16. eva2000

    eva2000 Administrator Staff Member

    53,531
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    10:42 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    did you log out of SSH session after passenger.sh addon install ?
    Code:
    ------------------------------------------
    Setup /usr/local/nginx/conf/passenger.conf
    -------------------------------------------
    Passenger root located at: /usr/local/rvm/gems/ruby-2.2.4/gems/passenger-5.0.23
    [1;32;40m-------------------------------------------
    (B[m[1;33;40mSetup completed...
    (B[m[1;32;40m-------------------------------------------
    (B[m
    Log out and log back into your SSH session
    to complete the next setup steps bellow
    Instructions also at https://community.centminmod.com/threads/3282
    Uncomment lines in /usr/local/nginx/conf/passenger.conf to enable passenger
    Nginx needs to have passenger nginx module compiled for it to work
    1. edit centmin.sh and set NGINX_PASSENGER=y
    2. run centmin.sh menu option 4 to recompile Nginx
    3. uncomment/enable /usr/local/nginx/conf/passenger.conf include file in nginx.conf
    4. then check that passenger module is in list of nginx modules via command:
    nginx -V
    This script only installs passenger, node.js, ruby, rails, rubygem and is provided as is.
    See Phusion Passenger documentation at for deployment and configuration at:
    * http://www.modrails.com/documentation/Users%20guide%20Nginx.html
    * https://github.com/phusion/passenger/wiki/Phusion-Passenger%3A-Node.js-tutorial
    * https://github.com/phusion/passenger/wiki
    Log out and log back into your SSH session
    to complete the next setup steps above
    Instructions also at https://community.centminmod.com/threads/3282
    Total Phusion Passenger Install Time: 28.889722720 seconds
     
  17. Juli112

    Juli112 New Member

    4
    2
    3
    Jan 23, 2016
    Ratings:
    +2
    Local Time:
    2:42 AM
    1.9.9
    Yes, I logged out after passenger addon install...
    I even tried a fresh centos 7 install now but got the same error again ("inc/nginx_configure.inc: line 433: passenger-config: command not found")
     
  18. eva2000

    eva2000 Administrator Staff Member

    53,531
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    10:42 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    what type of web hosting and server you using ? Xen, OpenVZ, KVM or dedicated ? who's web host ? are you by any chance using or setup sudo users ?

    also what's output for
    Code:
    which passenger-config
    and
    Code:
    passenger-config --nginx-addon-dir
     
  19. eva2000

    eva2000 Administrator Staff Member

    53,531
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    10:42 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    @Juli112 think i found the problem and solution, testing it out now :)
     
  20. eva2000

    eva2000 Administrator Staff Member

    53,531
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    10:42 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Updated both 123.08stable and 123.09beta01 with fix, so you can update your copy via centmin.sh menu option 23 submenu options 1 and 2 or just 2 if you previously have ran submenu option 1

    Upgrading Centmin Mod Code to Latest Version



    Upgrading Centmin Mod involves 2 parts.
    1. Upgrading the actual Centmin Mod code outlined at Upgrade Centmin Mod - CentminMod.com LEMP Nginx web stack for CentOS This is heart of Centmin Mod where the code is the engine that runs centmin.sh shell based menu and all the automation you're accustomed to.
    2. Upgrade software that Centmin Mod installed or manages. For this part following outline at Upgrade - How to upgrade Centmin Mod | Centmin Mod Community
    So essentially, you can upgrade from .07 to .08 in place, but not everything is upgraded as some things like server initial environment setup isn't changed i.e. how swap, tmp setup and allocation are created etc. The main parts from part 2 above are what in place upgrades do i.e. Nginx and PHP-FPM compilation and config/settings parameters and MariaDB version from 5.5 to 10.0.x. If you want the full environment changed including tmp and swap setup to .08's configuration, then you would need a fresh OS install and fresh .08 initial install. You can think of it like upgrading Windows 7 to Windows 8. An in place upgrade will upgrade code but won't change your computer environment from when you installed Windows 7 i.e. disk configuration and partition sizes won't change from when you initially installed Windows 7. Only way to change that would be fresh Windows 8 install.