Nginx - Hello World!
As part of my DevOps Stage 0 task, I was assigned to set up and configure NGINX on a fresh Ubuntu server hosted on Google Cloud Platform (GCP). This task was designed to test my ability to work with basic web server configurations and deliver a functional web server. Here’s a breakdown of my experience, challenges, and learnings.
Approach
Setting up the GCP instance
I started by creating a new virtual machine (VM) instance on GCP. I chose Ubuntu 20.04 LTS as the operating system and configured the instance with the necessary resources (1 vCPU and 3.75 GB RAM). After launching the instance, I connected to it via SSH using the GCP console.
Installing NGINX
Once connected to the VM, I updated the package list using
sudo apt update
. Then, I installed NGINX using the commandsudo apt install nginx
. After the installation, I ensured that NGINX was running by usingsudo systemctl status nginx
. This confirmed that the service was activesudo apt update sudo apt install nginx sudo systemctl start nginx sudo systemctl status nginx
Configuring the nginx default page
Next, I replaced the default NGINX landing page with a custom HTML page. I edited the file located at
/var/www/html/index.html
and added the following message:Welcome to DevOps Stage 0 - [Your Name]/[SlackName]
I replaced
[Your Name]
with my actual name and[SlackName]
with my Slack username.Configuring firewall rules
To allow HTTP traffic to the VM, I configured the firewall rules in the GCP console. I added a new rule to allow ingress traffic on port 80 (HTTP) for all IP addresses (
0.0.0.0/0
). This is to ensure that the webpage is accessible from any browser.
Challenges
Firewall Configuration on GCP
Initially, I couldn’t access the server’s IP address in my browser. After some troubleshooting, I realized that the default firewall rules on GCP were blocking HTTP traffic. To resolve this, I added a new firewall rule to allow traffic on port 80, as described above.File Permissions
When editing theindex.html
file, I encountered permission issues. I resolved this by usingsudo
to gain the necessary privileges to modify the file.
Contribution to learning goals
The task provided me with an hands-on experience on creating a simple web server on a remote virtual machine. It was a fun learning experience, despite the little challenges I encountered.
Further Reading
If you are a beginner devOps engineer like me, you might be interested in these engineering roles. Do well to check them out: DevOps Engineers , Cloud Engineers
Thanks for reading.