Skip to content

Instantly share code, notes, and snippets.

@jameslmartin
Last active September 16, 2021 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jameslmartin/471e8d5cac81c5c10286463b257bd657 to your computer and use it in GitHub Desktop.
Save jameslmartin/471e8d5cac81c5c10286463b257bd657 to your computer and use it in GitHub Desktop.
Installing nginx from Source

Installing nginx from Source

Following these instructions.

I would recommend using Ubuntu 18.04 LTS, specifically for certbot (which you will need for SSL). Certbot does not currently support 19.10.

Before installing pre-reqs (pre-pre-reqs)

Ensure that your system is up to date with apt-get update apt-get upgrade

Ensure essentials are on your machine apt-get install build-essential

Install pre-requisites

  • PCRE: The instructions above specify the FTP link for PCRE is incorrect. The actual FTP link for PCRE that works is ftp://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
  • zLib
  • Open SSL: Note that you can likely just run ./config if you are on a Linux like system and the installer will figure it out. The NGINX instructions have you specify your architecture

Installing NGINX

Pull down NGINX with wget, mainline is fine.

The biggest thing to remember when choosing this option of installing nginx is Ubuntu/Debian package managers install their registered nginx (i.e. with apt-get install nginx) usually to a different location than the one that the source instructions tell you. This means you can end up with two nginx installations. This has a few repurcussions:

  1. The yum/apt/apk installed nginx has finicky package management
  2. Installing from source with the source of the streaming plugin is the most reliable way to ensure which nginx knows where to look for the plugin
  3. If you are running SSL and pull certificates using Certbot, Certbot will attempt to use the installation of nginx located at which nginx - which will likely be a symlink to the package manager's installation. (Might be /usr/bin, etc. when from source you can choose the installation location - might be /usr/local/bin or /etc/local/nginx)
  4. This means you have to prefix your nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment