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;
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?
2
Answers
I’d personally use Amazon’s own repo.
The version provided by the Amazon repo is relatively old (
1.12.2
at the time of writing). To see what versions the Amazon repo has access to runIf you’d like a later version, consider EPEL.
In regards to the config, your best bet is to explicitly supply the configuration you require to the server.
Using the off-the-peg ones are fine to get you up and running. However you run the risk of things changing when Nginx updates. Explicitly supplying your own configuration gives you greater control over what is running.
Probably the simplest approach would be to upload the configuration generated by
nginxconfig.io
to S3.Then add a script via user data when creating the EC2 instance to download your configuration.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
Something like this…
The configuration supplied by
nginxconfig.io
sets up all the sites enabled/available for you.Alternative way to install that could be easier (has a fairly recent version of Nginx):