Install Nginx on EC2 Ubuntu instance

Fire up an EC2 Ubuntu instance


Connect via SSH as user ‘ubuntu’


Add nginx repo

File contents:

Save & close – [Esc] [w] [q] [Enter]


Install dev tools


where xxxxxxxxxxxxxxxx is a 16 digit hex code like 00A6F0A3C300EE8C THEN:


Install build tools for compiling


Create sources dir


Download and extract zlib ( )


Download and extract OpenSSL ( )


Download and extract PCRE ( )


Install dependencies


Download and install Nginx ( )

Note that 2>&1 | tee ~/sources/{file}.log logs the output to a file in your user’s home directory (on EC2 likely /home/ubuntu/) while still outputting to the console.

Now we can compile the installer. Warning – this is one LOOOONG-ass make…

If make fails with:

Nginx needs patching:

This means the lines ending in libssl.a and libcrypto.a need .openssl/lib/ removed from them.
To do this:

Navigate to and edit the code. Save and close. Run make again.

And finally, we can install:

3 thoughts on “Install Nginx on EC2 Ubuntu instance”

Leave a Reply

Your e-mail address will not be published. Required fields are marked *