This project is used to compile a self-contained NGINX that comes with useful modules and generate a deb file for easy installation on Debian based systems.
It is used by Cloud 66 to compile the default NGINX + Passenger installation for all servers. It can also be used by Cloud 66 users to generate their own NGINX installation and then upload it to a public location and tell Cloud 66 to install it via the manifest.
This project uses Docker to compile NGINX. You must have Docker installed on your host machine for the scripts to work.
You can compile NGINX for a specific combination of Ubuntu + NGINX + Passenger + release versions and CPU architecture (amd64 or arm64). The release version is used to cover dependencies that are not covered by the other versions, e.g. build dependency/NGINX module update. For Ubuntu 22.04, NGINX 1.30.1, Passenger 6.1.3, release 1.10.0 and arm64, this is done by running the following:
./compile_nginx.sh 22.04 1.30.1 6.1.3 1.10.0 arm64This will result in a Docker image which will contain NGINX + Passenger in a single tarball.
You can optionally compile Passenger Enterprise. To do this, you must have both the passenger_enterprise/passenger-enterprise-license (containing the Passenger Enterprise license) and passenger_enterprise/passenger-enterprise-server-${PASSENGER_VERSION}.tar.gz (containing the Passenger Enterprise source code) files present in the source root. Both can be acquired from the Passenger Enterprise portal.
To extract the tarball from the Docker image, you can run the following (for your combination of Ubuntu + NGINX + Passenger + release versions and CPU architecture):
./extract_nginx.sh 22.04 1.30.1 6.1.3 1.10.0 arm64
This will place the resulting tarball in the output.passenger directory, or in the output.passenger_enterprise directory when compiling Passenger Enterprise (i.e. when the Passenger Enterprise license and source files are present). For the previous extraction example, you will find one file under output.passenger/binaries: ubuntu-22.04-arm64-nginx-1.10.0.tar.gz.
The resulting tarball from the extraction step can be uploaded to the target server and installed as follows:
tar --no-same-owner -C / -zxvf <TARBALL>
Doing this will result in the following files under /usr/local/debs:
$ find /usr/local/debs/
/usr/local/debs/
/usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0
/usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/passenger-module
/usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/passenger-module/nginx-module-http-passenger_6.0.10+nginx1.20.1-1.0.0~bionic1_amd64.deb
/usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/nginx
/usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/nginx/nginx_1.20.1-1.0.0~bionic1_amd64.deb
/usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/prerequisites
/usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/prerequisites/openresty-lua-lrucache_0.10-1.0.0~bionic1_amd64.deb
/usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/prerequisites/modsecurity_3.0.4-1.0.0~bionic1_amd64.deb
/usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/prerequisites/openresty-luajit_2.1-20210510-1.0.0~bionic1_amd64.deb
/usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/prerequisites/openresty-lua-core_0.1.21-1.0.0~bionic1_amd64.deb
/usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/passenger
/usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/passenger/passenger_6.0.10-1.0.0~bionic1_amd64.deb
You can then install NGINX with the following:
sudo apt-get install /usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/prerequisites/*.deb /usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/nginx/*.deb
and Passenger (which depends on this NGINX installation) with the following:
sudo apt-get install /usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/passenger/*.deb /usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/passenger-module/*.deb
For Passenger Enterprise, you will also have the /usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/passenger-enterprise and /usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/passenger-enterprise-module directories, which you can install instead of the standard Passenger installation as follows:
sudo apt-get install /usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/passenger-enterprise/*.deb /usr/local/debs/ubuntu-18.04-amd64-nginx-1.0.0/passenger-enterprise-module/*.deb
Be sure to purge any traces of previous NGINX or Passenger installations before attempting this.
You can use these scripts to compile a version of NGINX for Cloud 66 (for example, with additional modules, or a different version of Passenger).
In order to do this, perform the compilation and extraction steps on your local machine, and then upload the resulting tarball to a public location (for example, using S3). You can then link to this location via the manifest, and this will result in your version of NGINX being installed for new servers.
Please make sure that the name of the tarball is not changed when uploaded to your public location.
Each release will be compiled for a specific version of NGINX + Passenger. Please see the releases for specific versions.
