Is Passenger Deprecated for Nginx versions above 1.14? - nginx

I updated nginx from version 1.14 to 1.18 (Ubuntu) on Ubuntu 18.04.
Doing so appeared to break passenger. So I uninstalled and attempted to reinstall the Open Source Passenger version via the Passenger installation Ubuntu 18.04 instructions.
I got to this line:
sudo apt-get install -y libnginx-mod-http-passenger
Which throws this error
libnginx-mod-http-passenger : Depends: nginx-common (< 1.14.1) but 1.18.0-3ubuntu1+bionic1 is to be installed
Update I also attempted with the enterprise version. Following the enterprise version installation instructions, I received a similar error message:
libnginx-mod-http-passenger-enterprise : Depends: nginx-common (< 1.14.1) but 1.18.0-3ubuntu1+bionic1 is to be installed
I did attempt to research the issue and I found this issue on Phusion's GitHub as well as this more recent issue. It appears that what most people are doing is rolling back their nginx version to 1.14.

It is not deprecated, no. The problem is that the packaged module you are trying to install was made for an older Nginx version that is distributed through the system default repository. This appears in the installation guide that you've mentioned:
At this point we assume that you already have Nginx installed from your system repository.
What this means is that the following instructions assume that you have Nginx specific version (1.14.0 in your case) installed, for which the packaged module was built. This is emphasised in the new passenger documentation:
If you want to use our packaged Nginx module, you must use your distro's provided Nginx package. If for example you have the repo provided by NGINX setup, you will instead need to compile a dynamic module compatible with that Nginx.
The link in the last quote will bring you to the guide on how to compile a dynamic passenger module and enable it in Nginx configuration. I will not repeat the whole process to keep the answer short but the general approach is this:
Get passenger module for Nginx source code.
Get Nginx source code for the version you have installed.
Compile Nginx with the passenger module:
cd /path-to-nginx-source-dir
./configure --prefix=/opt/nginx \
--with-some-configure-flag \
--add-dynamic-module=$(passenger-config --nginx-addon-dir) \
--add-module=/path-to-some-other-nginx-module
make
sudo make install
Make Nginx to load the module by adding this line to nginx.conf:
load_module modules/ngx_http_passenger_module.so;
Personally, I'd rather chosen the 'nginx-behind-nginx' approach than building the module. That is you have Nginx any version you like but it runs as a reverse proxy for another Nginx with passenger enabled (Passenger Standalone). With an unnoticeable penalty to performance this will be much easier to maintain (install, update). See this guide for details.

Related

Ambari Server on Ubuntu 18.04: Response 403 while pulling Apache Ambari repository

I'm a newbie to Ubuntu. Now I'm trying to install Apache Ambari Server on Ubuntu 18.04.
I've successfully completed steps like installing jdk, turning off firewall, stopping SELinux. However I came up against an error when running the command to pull Apache repo. The command is:
$ wget -O /etc/apt/sources.list.d/ambari.list http://public-repo-1.hortonworks.com/ambari/ubuntu18/2.x/updates/2.7.5.0/ambari.list
The error was some HTTP response failure with code 403: Forbidden. I also try another version for ambari (like 2.6.2.0) and even different link for the repo but still the error happened.
So anyone could tell me what is the problem and how to fix it? Thanks so much for helping me out!
I am trying to install ambari on CentOs. I found out that one of the providers cloudera has stopped freely offering the ambari installation starting from this year. You can take a look here. P.S. hortonworks should be under cloudera so that might be the reason why you cannot download the public image.
One of the solutions would be to follow the guide from Apache Ambari official website, which is over here. You can follow the installation guide there for your desired Ambari version on Ubuntu.
For example, if you are going to install Apache Ambari with version 2.7.5, you will find this page useful.
Below is based on my understanding and the instructions described on the documentation but I have not try it yet since my working environment is on CentOS.
Take installation on Ubuntu for instance
Step 1: Install the prerequisites
According to this answer, at least you might need to install python, node and npm on your machine.
Step 2: Build the project using maven
# download ambari
wget https://www-eu.apache.org/dist/ambari/ambari-2.7.5/apache-ambari-2.7.5-src.tar.gz (use the suggested mirror from above)
tar xfvz apache-ambari-2.7.5-src.tar.gz
cd apache-ambari-2.7.5-src
mvn versions:set -DnewVersion=2.7.5.0.0
pushd ambari-metrics
mvn versions:set -DnewVersion=2.7.5.0.0
popd
# build ambari
mvn -B clean install jdeb:jdeb -DnewVersion=2.7.5.0.0 -DbuildNumber=5895e4ed6b30a2da8a90fee2403b6cab91d19972 -DskipTests -Dpython.ver="python >= 2.6"
Step 3: Install Ambari Server
apt-get install ./ambari-server*.deb
Step 4: Setup and Start Ambari Server
# setup your server
ambari-server setup
# start your server
ambari-server start
Step 5: Install and Start Ambari Agent on All Hosts
Note: This step needs to be run on all hosts that will be managed by Ambari.
apt-get install ./ambari-agent*.deb
Edit /etc/ambari-agent/ambari.ini
...
[server]
hostname=localhost
...
Make sure hostname under the [server] section points to the actual Ambari Server host, rather than "localhost".
# start ambari agent
ambari-agent start

How to install a module on nginx?

When running nginx -t I get this error:
nginx: [emerg] unknown directive "subs_filter_types" in /etc/nginx/sites-enabled/my.site.com.conf:285
nginx: configuration file /etc/nginx/nginx.conf test failed
So I need to install the substitution filter module and in the nginx documentation https://www.nginx.com/resources/wiki/modules/substitutions/#subs-filter-types
Which says to run these commands:
git clone git://github.com/yaoweibin/ngx_http_substitutions_filter_module.git
./configure --add-module=/path/to/module
The problem is I don't have the configure script anywhere in my nginx installation nor in the
git repository. I really don't understand.
At the very least I want to know the content of that nginx configure script.
The instructions you are referring to are for compiled installation.
Assuming you want to add the module to your existing NGINX install, below are the generic steps that will get things running.
Fetch exactly matching version of NGINX as the one you have installed, from nginx.org onto your system and extract it to, say, /usr/local/src/nginx
git clone NGINX module's source code onto your system, to e.g. /usr/local/src/nginx-module-foo
cd /usr/local/src/nginx. This is where you will find the configure script. You will basically configure NGINX with the location of the config of specific module in question, thus next step:
./configure --add-dynamic-module=../nginx-module-foo --with-compat
make
As a resulf of the compilation you will have module's .so file somewhere in objs directory of your NGINX sources. You will then copy it over to e.g. /usr/lib64/nginx/modules/ directory.
To make your existing NGINX load the module, add load_module modules/foo.so; at the very top of /etc/nginx/nginx.conf.
You can decipher the many downsides to the whole compiled approach: one is having compilation software (gcc) on a production system, other is having to re-do all those steps any time you upgrade NGINX or the module.
For the reasons mentioned, you might want to search for a packaged install of third-party modules.
For CentOS/RHEL systems, you might want to look at GetPageSpeed repos (subscription-ware, and I'm biased to mention it, because I'm the maintainer. But this is free for CentOS/RHEL 8 at the time of this writing. Installing the module you want, goes down to a couple of commands:
yum -y install https://extras.getpagespeed.com/release-latest.rpm
yum -y install nginx-module-substitutions
For Debian-based systems, probably there are alternative PPAs existing for the same.
Just replace prefix subs with sub.
For default nginx 1.10.3 installation (Ubuntu 16.04.5 LTS)
nginx -V should have flag --with-http_sub_module to use sub_* directives.
Usage example:
sub_filter_types text/html text/css text/xml;
sub_filter 'needle' 'replacement';
sub_filter_once off;
NGINX documentation link

Compiling ModSecurity in NGINX OSS

I am trying to compile ModSecurity for the Nginx OSS web server. I have followed all of the instructions from their "Quick Start Guide", but am running into an issue. After linking up the new module, the config test fails.
Error output from /var/log/nginx/error.log is:
2018/02/10 00:47:51 [emerg] 6026#6026: module "/usr/share/nginx/modules/ngx_http_modsecurity_module.so" is not binary compatible in /etc/nginx/modules-enabled/50-mod-http-modsecurity.conf:1
originally the dynamic module was compiled with
sh
./configure --with-compat --add-dynamic-module=../ModSecurity-nginx
but this results in the error.
from what I've read, I need to compile the module with identical options as the existing Nginx instance.
I found the current options using nginx -V, and then re-ran the ./configure using all of the output options, but this gives the same error.
Can anyone point me down the right path here?
Thanks for any help.
UPDATE 10/29/18
It seems the original binary also needs to be compiled with the --with-compat flag. I have submitted a bug report on the issue that can be found here:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=897926
Maybe it can get some traction.
I had a similar issue. I was using Nginx 1.10.3 which is the default for Debian Stretch. This version does not seem to work with the latest Nginx ModSecurity connector.
I removed the default Nginx version and installed the latest stable Nginx from http://nginx.org/en/linux_packages.html. After that I was able to install and load the ModSecurity module for Nginx without problems. I followed this guide: https://www.linuxjournal.com/content/modsecurity-and-nginx for installing the ModSecurity module for Nginx.
The latest stable version of Nginx which is 1.14.2 supports the --with-compat flag. When compiling Nginx source code make sure to use the same compiler options that were used with your running Nginx. To find out which compile time options were used to build your currently running Nginx, run the command: nginx -V

Install Extensible Service Proxy on GCE/RHEL7

Quickstart for Endpoints on Compute Engine says
you need to run the Extensible Service Proxy before sending requests
to the API
But it also says
This quickstart works only on Debian. Make sure you create a VM that
runs Debian.
I have an existing GCE VM instance running Red Hat EL 7 that I'm adding this Endpoint to. Where are instructions for installing and running Extensible Service Proxy on it?
FWIW I examined the contents of the Debian package. It appears to be just nginx with custom configs and some extra scripts. If there's no RPM or other way of installing ESP on RHEL7, can I just manually install the contents extracted from the .deb package?
Yes, it should work (not tested). nginx in the .deb package is a statically compiled binary with a custom module that runs fine standalone. Please make sure to place the remaining files (config templates, root CA certificates, start-up script) in the same directories as in the .deb package.
The instructions for installing the ESP are implied in the instructions for installing the Cloud SDK on Red Hat and CentOS, since the endpoints-runtime RPM is available from the same repo as is the SDK.
$ sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
[google-cloud-sdk]
name=Google Cloud SDK
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOM
$
$ sudo yum install google-cloud-sdk
Note that the ESP installs as nginx, with supporting scripts and config files, that will replace any existing nginx and any files with the same name, which will overwrite any existing nginx functionality (like proxy, cache etc). It might be best to archive any host-specific nginx configs first, then install ESP, then merge old configs into the new ones installed by yum.

Not able to install/compile rtmp module for nginx using Homebrew

>brew install nginx-full --with-rtmp-module
Warning: homebrew/nginx/nginx-full-1.8.0 already installed
I already have installed nginx-full and I want to use rtmp module for streaming of videos. But I am not able to install it.
Does this mean that this module is already installed? I also ran
brew options nginx-full
which tells which tells what are the configuration options available (not sure). It showed around 30-40 modules including the rtmp. Does this mean rtmp module for nginx is already present.
I had the same problem, what you need to do is: reinstall Nginx with append options:
brew update
brew reinstall nginx-full --with-rtmp-module
This will result in having Nginx with the RTMP module.

Resources