Introduction
As part of my DevOps learning journey, I recently joined HNG12 internship and completed a hands-on task in setting up and configuring NGINX on a fresh Ubuntu server. This task was instrumental in strengthening my understanding of server configuration, security management, and web hosting fundamentals.
In this blog post, I will document my approach, the steps I followed, and how this experience contributes to my learning and professional growth.
My Approach
1.Set up an EC2 Instance on AWS
I started by launching an EC2 instance on AWS, selecting Ubuntu as my operating system. This provided a fresh environment to configure and deploy my web server.
2. Configured Security Group
Next, I edited the security group settings to allow necessary inbound and outbound rules:
Inbound Rules:
- SSH (Port 22) – Allowed to securely connect to the instance.
- HTTP (Port 80) – Enabled to serve web traffic.
Outbound Rule:
- HTTP (Port 80) – Allowed outbound HTTP requests.
3. Connected to the instance via SSH
Using Git Bash, I connected to my EC2 instance via SSH with the following command:
ssh -i "key.pem" ubuntu@ec2-public-ip
4. Updated and upgraded NGINX
Before installing NGINX, I updated and upgraded the Ubuntu server to ensure it has the latest software versions:
sudo apt update
sudo apt upgrade
5. Installed NGINX
I installed NGINX using the command:
sudo apt install nginx -y
To confirm that NGINX was running, I checked its status using:
sudo systemctl status nginx
If not started or enabled, use
sudo systemctl start nginx
sudo systemctl enable nginx
At this point, accessing http://ec2-public-ip( mine is http://52.91.162.32/) in a browser displayed the default NGINX welcome page.
6. Replaced the default NGINX page
I then created a custom HTML file to replace the default NGINX welcome page.
Using nano, I created and edited the file:
sudo nano /var/www/html/index.html
I replaced the content with my html file content and saved it.
Visiting my public IP address(http://52.91.162.32/) in a browser now displayed my custom html welcome message.
How This Task Contributes to My Learning and Professional Goals
This experience was a great opportunity to apply DevOps best practices in a real-world scenario. I,
- Gained hands-on experience with AWS EC2, Linux server administration, and NGINX configuration.
- Improved my understanding of security group configurations and SSH connectivity.
- Strengthened my skills in basic web hosting and automation.
- Learned the importance of server updates and proper service management.
References
https://hng.tech/hire/cloud-engineers
https://hng.tech/hire/aws-solutions-architects
Conclusion
Setting up and configuring NGINX on an Ubuntu server was an enlightening experience. This task reinforced my understanding of web server configurations, security best practices, and cloud infrastructure management. I look forward to building more complex deployments and automating server configurations in my DevOps journey!
Top comments (0)