2

Introduction

At the moment there are approximately 100 Puppet agents that connect to the Puppetmaster. Sometimes it takes a while before implemented changes on the Puppetmaster are picked up by the agents. Some information has been found that Passenger combined with a web server, e.g. Apache2 or Nginx could accelerate this process. Above all, according to this documentation it is strongly recommended to use such functionality in Production environments.


Aim

The aim is to install Nginx and implement Phusion Passenger support on CentOS7 using passenger-install-nginx-module to accelerate the recognizing of changes implemented on the Puppetmaster by Puppet-agents.


Attempts

Attempt 1

sudo /usr/local/share/gems/gems/passenger-4.0.56/bin/passenger-install-nginx-module --auto --auto-download was executed and the installation steps were followed.

Attempt 2

As the Nginx service was not installed during attempt 1, it was installed using yum -y install nginx.

Attempt 3

Googling: "[emerg] unknown directive passenger_enabled" indicated that nginx was compiled without Phusion Passenger support. In this case this should be false as passenger-install-nginx-module has been run and the output of the installation during attempt 1 indicated that Nginx should have been installed.

Attempt 4

/etc/nginx/nginx.conf

passenger_root  /usr/local/share/gems/gems/passenger-4.0.56;
passenger_ruby  /usr/bin/ruby;

/etc/nginx/conf.d/puppet.conf

passenger_enabled          on;

Attempt 5

To test whether this issue occurs using another web server as well sudo /usr/local/share/gems/gems/passenger-4.0.56/bin/passenger-install-apache2-module was executed.


Expected outcome

Executing passenger-install-nginx-module and completing the installation steps installs Nginx. Nginx service can be started and Phusion-Passenger support is included. Checking whether port 8140 is in LISTEN state should result in true as Nginx should start the Puppetmaster.


Current outcome

Executing passenger-install-nginx-module and completing the installation steps does not install Nginx while the output indicates the contrary.

Nginx with Passenger support was successfully installed.

Please edit your Nginx configuration file (probably /opt/nginx/conf/nginx.conf),
and set the passenger_root and passenger_ruby configuration options in the
'http' block, like this:

  http {
      ...
      passenger_root /usr/local/share/gems/gems/passenger-4.0.56;
      passenger_ruby /usr/bin/ruby;
      ...
  }

Installing Nginx using yum does not work either. The issue persists even when passenger-install-nginx-module is executed again.

[vagrant@vm-one ~]$ sudo systemctl status nginx.service -l                        
   nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled)
   Active: failed (Result: exit-code) since Thu 2015-01-01 01:55:56 UTC; 
  2min 19s ago
  Process: 7963 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=0/
  SUCCESS)
  Process: 7935 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
  Process: 10814 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
 Main PID: 7937 (code=exited, status=0/SUCCESS)

Jan 01 01:55:56 vm-one.local systemd[1]: Starting The nginx HTTP and reverse 
proxy server...
Jan 01 01:55:56 vm-one.local nginx[10814]: nginx: [emerg] unknown directive
 "passenger_enabled" in /etc/nginx/conf.d/puppet.conf:5
Jan 01 01:55:56 vm-one.local nginx[10814]: nginx: configuration file /etc/nginx
 /nginx.conf test failed
Jan 01 01:55:56 vm-one.local systemd[1]: nginx.service: control process exited,
 code=exited status=1
Jan 01 01:55:56 vm-one.local systemd[1]: Failed to start The nginx HTTP and
reverse proxy server.
Jan 01 01:55:56 vm-one.local systemd[1]: Unit nginx.service entered failed state.

Trying to install another web server with Passenger support results in:

 * Checking for Apache 2...
      Found: no
 * Checking for Apache 2 development headers...
      Found: no

This indicates that passenger-install-apache2-module in contrast to passenger-install-nginx-module seems to check whether a web server has been installed or not.

5

I am the Phusion Passenger author. You are misunderstanding something fundamentally about Nginx.

First of all, Nginx does not support dynamically loadable modules. This means that the only way to extend Nginx, is by recompiling Nginx from scratch, with certain modules included.

In your mental model, you seem to think that passenger-install-nginx-module installs a module file somewhere, and that yum install nginx installs an Nginx instance somewhere, which then loads the Passenger module. This is false. passenger-install-nginx-module compiles an entirely new Nginx from scratch, with the Passenger module enabled and statically linked inside it. Depending on the parameters you gave it (most notably the installation prefix), you will end up with an entirely separate Nginx installation -- one that is totally independent from the one you install with yum.

This is documented extensively on the Passenger wiki: Why can't Passenger extend my Nginx?. This is not something that we -- Passenger's authors -- decided. This is how Nginx itself fundamentally works, and we can't change this. Installing any Nginx module is like this. It is in stark contrast to Apache modules, which do work the way you think they work.

Second, you seem to be under the assumption that installing the Nginx service is something that Passenger takes care of. This is false. Service definitions are completely platform-specific and even distribution-specific add-ons, added by the distribution's packagers. Service definitions are neither included in the Nginx source code, nor installed by Passenger. Thus, if you install Passenger/Nginx from source (as opposed from RPMs) then you must install service definitions yourself. There is a section in the manual about this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.