I’m excited to embark on this journey and I decided to write a blog post on how to configure and set up an Nginx webserver.
My goal for this project was to
Set up a web server (NGINX) on an Ubuntu instance.
Serve a custom HTML page with a welcome message.
Ensure the webpage is accessible via a public IP address.
** Step 1: The Instance Setup**
First things first, I decided to use the AWS cloud provider since I was a lot more familiar with it as opposed to other cloud providers such as GCP, Azure, and Digital Ocean.
I started by logging in to my Aws console and ensured I observed best practices by not logging in as the root user but as a user with certain permissions to perform certain tasks.
I proceeded to launch an EC2 instance by using a designated name, an Ubuntu server, a t2 micro as the instance type as it is a free tier. I also used the already assigned vpc for the security group;part of the requirement was to enable inbound traffic from port 80(http), and port 22 (ssh). I ensured this requirement was met under the Security Group drop-down by checking the boxes of this port following which I proceeded to launch my instance.
After the instance was launched, connected my launched instance to the terminal directly from my Aws console.
** Step 2: Updating and Upgrading**
Before installing anything new, it is always a good practice to update and upgrade the system. This ensures that the latest security patches and bugs and fixed.A terminal window was opened on my server and the following commands were executed:
‘sudo apt update’
‘sudo apt upgrade -y’
P.S: I used Sudo because it grants root user permission
Step 3: Installing NGINX
To install NGINX on Ubuntu. I simply used the apt package manager:
‘sudo apt install nginx’
The system downloaded and installed NGINX along with any necessary dependencies.
Step 4: Starting NGINX
Once the installation was complete, I needed to start the NGINX service. I did this using the following command:
‘sudo systemctl start nginx’
To verify if NGINX is running, I copied my public IP address and pasted it in a browser and I got the ‘Welcome to NGINX’ which meant my server was up and running.
Step 5: Creating the Custom HTML Page
I proceeded to create the custom HTML page that NGINX will serve.
I ‘cd’ into the directory and used a simple text editor(Nano) to create a file named index.html in the /var/www/html/ directory:
‘sudo nano /var/www/html/index.html’
Inside this file, I added the following HTML code: <!DOCTYPE html>
Welcome to DevOps Stage 0
Welcome to DevOps Stage 0 -[Bisola Adesola]/[Bisola Janet]
** Step 6: Testing My Website**
Finally, I opened a web browser and pasted in the public IP address of my server. And voila! My custom HTML page was displayed.
Challenges and Learnings
- The first challenge was that my Aws console was refusing to load certain services which I thought was a connection problem but I eventually figured out it was a downtime problem with the provider.
- Troubleshooting: I encountered a few minor challenges along the way, such as permission errors and typos in the configuration file. Troubleshooting these challenges helped me develop problem-solving skills.
Key Takeaways
- Setting up and configuring NGINX is a rewarding experience that provides a solid foundation for further DevOps exploration.
- Understanding the setup of security groups such as inbound and outbound rules.
- Online resources and community are invaluable for learning and troubleshooting.
Next Steps
I’m eager to learn more, lay my hands on more projects and delve deeper into the world of DevOps. I plan to explore topics like reverse proxying, load balancing, networking, and security best practices.
This challenge has been a fantastic starting point for my HNG DevOps journey.
I’m excited to see where it takes me!
I hope this step-by-step guide is helpful for other beginners.
In need of some skill set?
Hire a world-class talent in:
- DevOps Engineer:https-//hng.tech/hire/devops-engineers
- Cloud Engineer:https-//hng.tech/hire/cloud-engineers Site Reliability Engineers - https://hng.tech/hire/site-reliability-engineers
- Platform Engineers - https://hng.tech/hire/platform-engineers
- Infrastructure Engineers - https://hng.tech/hire/infrastructure-engineers * Kubernetes Specialists - https://hng.tech/hire/kubernetes-specialists * AWS Solutions Architects - https://hng.tech/hire/aws-solutions-architects
- Azure DevOps Engineers - https://hng.tech/hire/azure-devops-engineers * Google Cloud Engineers - https://hng.tech/hire/google-cloud-engineers * CI/CD Pipeline Engineers - https://hng.tech/hire/ci-cd-pipeline-engineers
- Monitoring/Observability Engineers - https://hng.tech/hire/monitoring-observability-engineers
- Automation Engineers - https://hng.tech/hire/automation-engineers
- Docker Specialists - https://hng.tech/hire/docker-specialists
- Linux Developers - https://hng.tech/hire/linux-developers
- PostgreSQL Developers - https://hng.tech/hire/postgresql-developers
by clicking on the link.
Top comments (0)