How to install NGINX on AWS EC2 Linux 2

mapping dom picture mapping dom · Sep 4, 2019 · Viewed 54.3k times · Source

I'm new to AWS and trying to understand which version of NGINX I should be installing on my instance. I've found multiple options;

  • Via EPEL as the blog entry
  • Amazon's own (?) version as this answer
  • The 2016 NGINX official tutorial

On my development environment (Centos VM) I used sudo yum install nginx. Having tried the EPEL route I don't get the same set up, in particular sites enabled/available is not created as part of the setup. I want to use nginxconfig.io which requires those. Which version of NGINX should i use for that?

Answer

KBoek picture KBoek · Apr 16, 2020

Alternative way to install that could be easier (has a fairly recent version of Nginx):

$ sudo amazon-linux-extras list | grep nginx
 38  nginx1=latest            disabled      [ =stable ]

$ sudo amazon-linux-extras enable nginx1
 38  nginx1=latest            enabled      [ =stable ]
        
Now you can install:
$ sudo yum clean metadata
$ sudo yum -y install nginx
    
$ nginx -v
nginx version: nginx/1.16.1