k1.4 — Safety & Learning Workflow 🛡️
The goal here is to make you fast at learning without “mystery breakage” or data loss. Your two pillars are:
- Reversibility (you can undo changes)
- Traceability (you can explain what changed and why)
1) Always have a rollback
-
Use snapshots for “big steps”
- If you’re learning in a VM, take a snapshot before:
- installing a web stack
- changing firewall rules
- editing service configs (Nginx/PHP-FPM/SSH)
- doing major upgrades
- Name snapshots clearly, e.g.
pre-nginx,before-php82,working-tls.
- If you’re learning in a VM, take a snapshot before:
-
Back up configs before you edit
- Use simple, consistent backups:
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak- Or add a timestamp:
cp file file.$(date +%F_%H%M).bak
- Use simple, consistent backups:
-
Keep “known good” copies
- For key files, keep a minimal working baseline you can restore quickly (especially useful for Nginx virtual hosts and PHP-FPM pools).
2) Make changes intentionally (one variable at a time)
-
Change one thing → test → observe
- After each change, immediately validate:
- Is the service still running?
- Did logs change?
- Is the port listening?
- Does the browser/curl test pass?
- After each change, immediately validate:
-
Prefer small edits over big rewrites
- Comment or duplicate blocks rather than deleting until you’re confident.
-
Avoid “random fix” spirals
- If you try 5 things at once, you won’t know which one worked (or what caused the break).
3) Keep a tiny change log (it pays off quickly)
Use a simple text file (e.g. ~/lab-notes.md) and record:
- What you changed (file/service)
- Why you changed it
- How you tested it
- What happened (success/error + log snippet)
Example format:
2026-04-04— edited/etc/nginx/sites-available/example- Reason: add reverse proxy to app on
:3000 - Test:
nginx -t,systemctl reload nginx,curl -I http://localhost - Result: OK / or error + relevant line from logs
- Reason: add reverse proxy to app on
This becomes your personal “ops memory” ✅
4) Practice in layers (a safe progression)
Follow this order to minimize confusion:
Each layer assumes the previous one—this prevents “I don’t even know what I broke” moments.
5) A minimal “safe workflow” you can reuse
When making a change to a service (Nginx/PHP/SSH), do this every time:
- Backup
- Copy the config file you’re touching.
- Validate config
- Example pattern:
- Nginx:
nginx -t - (Other services have equivalents; you’ll learn them as we go.)
- Nginx:
- Example pattern:
- Reload, don’t restart (when possible)
- Reload applies changes with less downtime and less risk.
- Check logs immediately
- Use service logs to confirm it started cleanly.
- Test from the client side
curl, browser, or a health endpoint.
Optional: tell me your practice setup
To tailor the labs, which environment will you use first?
- VM (VirtualBox/VMware/Proxmox)
- VPS (a real server over SSH)
- WSL/macOS terminal + remote Linux
- Containers only (Docker)