# Passenger Installs Twice



## daBee (Aug 28, 2018)

Here is the current error involving Passenger:


```
You are currently validating against Phusion Passenger 5.3.4, located in:

     /usr/local/lib/ruby/gems/2.5/gems/passenger-5.3.4/bin/passenger

   Besides this Passenger installation, the following other
   Passenger installations have also been detected:

     /usr/local/bin/passenger

   Please uninstall these other Passenger installations to avoid
   confusion or conflicts.
```

I encountered the same before, decided to deinstall www/nginx and www/rubygem-passenger. 

I checked these locations, found neither Passenger was installed.  So none were there.  I installed the same ports, www/nginx first, then www/rubygem-passenger.  Then I got this error again upon the `passenger-config validate-install`. 

So, installing both these ports, I get two Passengers.  How can I fix this?


----------



## SirDice (Aug 29, 2018)

daBee said:


> I checked these locations, found neither Passenger was installed.


I'm betting one of them was installed through `rbenv`.


----------



## daBee (Aug 29, 2018)

OK, removed associated versions of ruby, removed rbenv.  Installed lang/ruby25, bundler and updated Gems.  Passenger checks fine.

New issues on testing nginx:


```
Performing sanity check on nginx configuration:
nginx: [emerg] unknown directive "passenger_root" in /usr/local/etc/nginx/nginx.conf:17
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed
```

That line:

`passenger_root        /usr/local/lib/ruby/gems/2.5/gems/passenger-5.3.4;`


```
$ which passenger
/usr/local/lib/ruby/gems/2.5/gems/passenger-5.3.4
$ passenger-config --root
/usr/local/lib/ruby/gems/2.5/gems/passenger-5.3.4
```

I even reinstalled www/rubygem-passenger and same issue.  Now nginx isn't happy with Passenger.  I don't have RVM nor rbenv.  I don't know what else I can do.

You know, for such a famous stack, you would think this would be polished and effortless.

Edit:  At this point I'm not sure if that *unknown directive* is whining that it doesn't know Passenger or its value.


----------



## SirDice (Aug 29, 2018)

Make sure it's rubygem-passenger-nginx and not rubygem-passenger-apache that you installed. I don't use nginx for Passenger (we use Apache instead) so I'll have to guess a few things. Make sure the passenger module exists in /usr/local/libexec/nginx/ and that you load that module in nginx.conf.

As an example, Apache requires this:

```
LoadModule passenger_module /usr/local/lib/ruby/gems/2.3/gems/passenger/buildout/apache2/mod_passenger.so
```

I'm quite sure nginx would require a similar line in order to load the module.


----------



## daBee (Aug 29, 2018)

Yes, took care of that days ago.  OK, seems that module needed to be called for some reason.  It was in my nginx.conf but commented out.  

OK, things seem like something resembling normal.  Cheers.


----------



## SirDice (Aug 29, 2018)

daBee said:


> OK, seems that module needed to be called for some reason.


I'm not sure why this is though, I can remember nginx automatically loading installed modules but since a couple of versions ago you need to explicitly load them in the configuration.


----------



## daBee (Aug 29, 2018)

That's exactly it.  I was confused on the necessity to call modules.  In all cases such as this, I don't *mind* this changing, as long as it gets my attention quickly through documentation, or in any error feedback.  Otherwise I spend days chasing single lines like this.


----------



## SirDice (Aug 29, 2018)

Typically errors like 'unknown directive' means a specific module isn't loaded (or failed to load for some reason). You'll get similar errors in Apache if you forget to load a module. So it was fairly quickly fixed. But it was definitely an unexpected change in behavior.


----------

