Your Mission
There is an Nginx web server installed on your machine. It is currently broken.
The Rules of Engagement:
- Goal: Get
curl localhostto show the "Victory" message. - Tools: Google, ChatGPT, and AI are ALLOWED.
- Win Condition: Raise your hand when fixed. You must EXPLAIN the bugs to the judge. If you can't explain why it works, you don't win.
01. The Crash Course
Don't panic. Here is everything you need to know.
The Superuser (sudo)
Analogy: "Administrator Mode" or "Simon Says".
Linux protects system files (like web configs) from accidental damage. If you try to edit them as a normal user, it will say "Permission Denied."
Typing sudo before a command tells the computer: "I know what I'm doing, do it anyway."
sudo nano /etc/hosts
# Install software
sudo apt install nginx
Services (systemctl)
Analogy: A restaurant kitchen.
Most programs stop when you close them. "Services" (or Daemons) run in the background forever, waiting for customers (web visitors). You control them with systemctl.
Important: If you change a config file, the service won't know until you restart it!
systemctl status nginx
sudo systemctl restart nginx
Permissions (chmod)
Analogy: ID Card Access.
Every file has 3 rights: Read (4), Write (2), eXecute (1).
Permissions are often shown as numbers:
7(4+2+1) = Read, Write, Execute6(4+2) = Read, Write4(4) = Read only
sudo chmod 644 filename.html
# Give everyone everything (Unsafe)
sudo chmod 777 filename.html
Logs
Analogy: The Black Box Recorder.
Linux is often silent. If you run a command and nothing happens, it usually worked.
If it fails, it writes the reason into a log file. You just have to find it.
journalctl -xe
tail -n 20 /var/log/nginx/error.log
02. Helpful Commands
| Command | Category | What it does |
|---|---|---|
| nano / vim | Editing | Text editors to change config files. |
| cat | Reading | Prints file contents to screen. |
| grep | Search | Searches for a specific word inside a file. |
| curl | Network | Fetches a webpage from command line. |
| ss -tuln | Network | Shows open ports. Crucial for servers. |
| ps aux | Process | Shows all currently running programs. |
03. The OODA Loop
Observe
Run the command. What exact error message did you get?
Orient
Read the error, and copy it. Paste it into Google or ChatGPT for additional help (if necessary).
Decide
Based on the search (or your own knowledge), what file needs editing? What command fixes it?
Act & Loop
Execute the fix. Test again. If it fails, go to Step 1.