Setting up Nginx and HTTPS on AWS
I first deployed this portfolio on AWS EC2 to get hands-on experience with Linux hosting, DNS, and HTTPS. These are my notes from setting up the server in January 2026.
The setup
I used an EC2 instance running Amazon Linux 2023, Nginx to serve the site, Namecheap for the domain and DNS, and Certbot for a Let’s Encrypt certificate.
Server access and Nginx
I created an SSH key pair and restricted port 22 to my IP address. Ports 80 and 443 were open for web traffic. After connecting to the server, I updated the packages and installed Nginx.
sudo dnf update -y
sudo dnf install nginx -y
sudo systemctl enable --now nginxConnecting the domain
I pointed the A records for frederickatasina.com and www to the EC2 public IP. Then I created a website directory and configured Nginx to serve its files for those hostnames.
server {
listen 80;
server_name frederickatasina.com www.frederickatasina.com;
root /var/www/frederickatasina.com/html;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}Before reloading Nginx, I checked the configuration with sudo nginx -t. That helped separate configuration errors from DNS and firewall issues.
Adding HTTPS
I used Certbot to request a certificate for both hostnames and update the Nginx configuration.
sudo dnf install certbot python3-certbot-nginx -y
sudo certbot --nginx -d frederickatasina.com -d www.frederickatasina.comWhat I learned
A deployment depends on several pieces agreeing: the DNS records, security group, Nginx configuration, and certificate. Checking them one at a time made troubleshooting easier.
My next step was to run the Next.js application behind Nginx, with PM2 managing the process.
Read about the Next.js deployment →