DEV Community

Cover image for Nginx web-server Installation and Configuration With Custom HTML content on AWS Cloud
Mayowa
Mayowa

Posted on

Nginx web-server Installation and Configuration With Custom HTML content on AWS Cloud

In this short guide, I’ll walk you through setting up Nginx server to serve a static HTML page on Aws Ubuntu Linux.

Step 1: Bootstrapping nginx installation on Ubuntu Linux and starting the nginx server with Aws user data, using terraform script.
Step 2: Creation of a custom HTML page using terraform script on aws user data.
Step 3: Bootstrapping nginx configuring page on Aws user data, using terraform script.
Step 4: Accessing the custom page through: http://18.219.113.173:80/index.html

Challenges faced:

  • After the installation and configuration of nginx on aws cloud, I struggled to locate my custom html page. I kept seeing the nginx default page.

  • I omitted the addition of ssh security, so I wasn't able to access the server.

  • I also forgot to map the endpoint with port 80 (http) during server provisioning, so I wasn't able to access the URL on port 80.

Solution:
-After a little troubleshooting and careful study of the terraform script, I discovered it was because I didn't add port 80 in the terraform script. Then I edited the script and added the port and the issue was resolved.

-After careful study of the script, I discovered that it was because I didn't add the index.html path during nginx configuration. I edited the configuration file and added the path and the problem resolved.

  • After going through my terraform script, I discovered that I forgot to add ssh security group and after adding it, I was able to access the nginx server.

Personal Growth:
I can now confidently deploy html custom contents on a lightweight web-server like nginx.

With this few steps, you can deploy a custom HTML page on Nginx running locally. This setup is perfect for testing static websites, local development, or learning how Nginx works.

You can access the server through the following URL:
http://18.219.113.173:80/index.html

References:
https://hng.tech/hire/devops-engineers

Top comments (0)