Installing nginx and certbot on AWS EC2
AWS

Installing nginx and certbot on AWS EC2

Marcell Simon
Marcell Simon

For EC2 instances that are running Amazon Linux 2 AMI, you have to enable EPEL repository:

sudo yum update
sudo amazon-linux-extras install epel

Then you can install nginx and certbot

sudo amazon-linux-extras install nginx1.12
sudo yum install -y certbot python2-certbot-nginx

After setting up your nginx configs with the proper server_name tags, you can install the certificates

sudo certbot --nginx -d yourdomain.com

nginx won't start automatically with the system, so you have to setup:

sudo chkconfig nginx on

or

sudo systemctl enable nginx

Also, for some reason, EC2 won't work correctly after nginx install, so reboot the machine.

sudo reboot