This task has two major parts:
- Install and configure NGINX on an Ubuntu server.
- Write a blog article about your experience.
Part 1: Installing and Configuring NGINX
You will install NGINX, a web server, on an Ubuntu system and configure it to serve a custom HTML page.
Step 1: install NGINX.
Open the Ubuntu terminal.
Update the package lists: sudo apt update
After performing the command sudo apt update, the programming went smoothly, except for these errors, which indicate that my Ubuntu system failed to download package index files from the required repositories. Now we will try and fix this errors with the following commands below:
- ping -c 4 google.com
- If you receive responses like "64 bytes from...", your internet is working properly.
If not, check your network configuration.
So, obviously, this error has not been cleared away, but it does impede the task in any manner. W: Failed to load https://download.docker.com/linux/ubuntu/dists/noble/InRelease. Cannot wait for server fd - choose (11: Resource temporarily unavailable) [IP: 108.157.78.123 443]
Install NGINX:sudo apt install nginx -y
The installation went well and port 80 is already in use.
Check if NGINX is running:sudo systemctl status nginx
After running the above command I ran into the errors and I have to find a way to fix it.
Solution: Stop the Docker Container Using Port 80
1️⃣ Find the Docker container using port 80
Run this command: sudo docker ps
Look for the container that is exposing port 80 in the PORTS column (e.g., 0.0.0.0:80->80/tcp).
2️⃣ Stop the container
Replace with the actual container ID from the previous command:sudo docker stop
There was a running Nginx called b4e00baaddbb that needed to be stopped before proceeding with the task.
3️⃣ Confirm that Docker has released port 80
Run: sudo lsof -i :80
If nothing appears after this command, Docker has stopped using the port.
4️⃣ Restart Nginx
Now, restart Nginx and check its status:sudo systemctl restart nginx
sudo systemctl status nginx
If everything is working, it should show active (running). As shown above in the imaged pointing at the command.
Enable it to start on boot: sudo systemctl enable nginx
Step 2: Create a Custom HTML Page
Open the default index.html file: sudo nano /var/www/html/index.html
- Press CTRL + X, then Y, then Enter.
Step 3: Restart NGINX
Apply the changes:sudo systemctl restart nginx
Step 4: Find Your IP Address
Run this command: ip a
Step 5: Test in a Browser
Open your browser and go to: http:///
http://192.168.129.128
You should see:
"Welcome to DevOps Stage 0 - Busa Ayim-Odu/chilled_guy"
Challenges and Solutions
Problems I Ran into
To fix APT update issues, ensure network access and run sudo apt update --fix-missing.
Port 80 is already in use. I identified and halted the running Docker container.
The NGINX service fails to start: I restarted NGINX after fixing the port problem.
- How Does This Task Help My Career?
The importance of NGINX in DevOps
Web server and reverse proxy: NGINX is commonly used for website hosting and load balancing.
Real-world troubleshooting: Debugging service faults is an essential DevOps skill.
Hands-on experience: This assignment helped me strengthen my Linux server management skills.
- Reference Links
I used the following links:
This work taught me how to set up and debug web servers, which is crucial for DevOps tasks.
Top comments (0)