How to install phusion passenger and Nginx from source

I have a script that compiles latest nginx and now I will extend this script to compile passenger into nginx binary.

Here is my nginx compiler script:

gem update passenger

cd /usr/local/src
rm nginx-$VERSION.tar.gz
tar -xzvf nginx-$VERSION.tar.gz
./configure --sbin-path=/usr/sbin/nginx \
  --pid-path=/var/run/ \
  --lock-path=/var/lock/nginx.lock \
  --conf-path=/etc/nginx/nginx.conf \
  --user=www-data --group=www-data \
  --error-log-path=/var/log/nginx/error.log \
  --http-log-path=/var/log/nginx/access.log \
  --with-http_ssl_module \
  --with-http_gzip_static_module \
  --without-http_ssi_module \
  --without-http_userid_module \
  --without-http_upstream_ip_hash_module \
  --without-http_uwsgi_module \
  --without-http_scgi_module \
  --without-http_split_clients_module \
  --without-http_referer_module \
  --without-http_memcached_module \
  --without-http_browser_module \
  --without-http_upstream_ip_hash_module \
  --with-mail_ssl_module \
  --with-mail  \
  --without-mail_smtp_module \
  --with-pcre \
  --with-http_stub_status_module \
  --without-http_charset_module \
  --without-http_geo_module \
  --without-http_map_module \
  --add-module=`passenger-config --nginx-addon-dir`


Obviously you have to change the configruation as you need. Altough nginx make install command will backup your current nginx binary, you should make a backup of this file manually too. I always make one. I stop monit before install nginx because I want to control of nginx starting/restarting.

Before restart nginx, make sure you added the passenger_root and passenger_ruby directives to your nginx config file.

Values of these directive are easily available from passenger commandline tools: “` $ passenger-config –root /usr/local/rvm/gems/ruby-2.2.2/gems/passenger-5.0.14 $ passenger-config –ruby-command passenger-config was invoked through the following Ruby interpreter: Command: /usr/local/rvm/gems/ruby-2.2.2/wrappers/ruby Version: ruby 2.2.2p95 (2015-04-13 revision 50295) [x8664-linux] To use in Apache: PassengerRuby /usr/local/rvm/gems/ruby-2.2.2/wrappers/ruby To use in Nginx : passengerruby /usr/local/rvm/gems/ruby-2.2.2/wrappers/ruby To use with Standalone: /usr/local/rvm/gems/ruby-2.2.2/wrappers/ruby /usr/local/rvm/gems/ruby-2.2.2/gems/passenger-5.0.14/bin/passenger start

Notes for RVM users

Do you want to know which command to use for a different Ruby interpreter? ‘rvm use’ that Ruby interpreter, then re-run 'passenger-config about ruby-command’. ”`

After check nginx works fine, you can turn on again monit. Probably it will complain about the nginx_bin checksum changing.


Read more posts by this author.