Server Administration โ€ข Quick Reference

Server Administration: systemd, Nginx & Active Directory

Your desk-side survival guide for managing Linux background services, web reverse proxies, Windows Active Directory domains, and scheduled tasks without breaking production.

โฑ๏ธ 10 min reference๐ŸŸข Beginner โ†’ SysAdmin๐Ÿ“… Updated: 2026

Service Lifecycle Anatomy

Almost every Linux service command follows the same 3-part pattern: Manager + Action + Unit.

systemctl status nginx
Manager systemctl Talks to systemd (PID 1)
Action (Verb) status What to do (start, stop, reload)
Unit (Service) nginx Target service (.service implied)
Memory Trick: start / stop controls the service right now. enable / disable controls whether it starts automatically after a reboot. Use --now (e.g., systemctl enable --now nginx) to do both at once!
CLIENT Browser / curl HTTPS :443 TLS / HTTP REVERSE PROXY Nginx (:80 / :443) /etc/nginx/sites-enabled/ Terminates SSL โ€ข Routes traffic proxy_pass APP SERVICE (systemd) app.service (:8080) systemctl status app Managed by PID 1 Logs: journalctl -u nginx -f | journalctl -u app -xe

How a web request flows: Nginx faces the internet on ports 80/443 and forwards traffic to your internal systemd app service.

1 Linux systemd & journalctl Commands

systemd is the service manager (PID 1) on modern Linux distributions (Ubuntu, Debian, RHEL, Rocky, Alma). journalctl reads the centralized logs it collects.

sudo systemctl start nginx
Start a service immediately Launches the daemon right now. Does not persist after a reboot unless enabled.
sudo systemctl stop nginx
Stop a running service Gracefully shuts down the service process.
sudo systemctl restart nginx
Hard restart (stop + start) Kills existing worker processes and starts fresh. Briefly drops active connections.
sudo systemctl reload nginx
Zero-downtime config reload Applies new config files without dropping live users (best for Nginx/Apache).
sudo systemctl enable --now nginx
Start now + auto-start on boot Creates the boot symlink and starts the service in a single command.
systemctl status nginx
Check health, PID, and recent logs Look for active (running) in green and the last 10 log lines.
journalctl -u nginx -f
Follow live logs for one unit -u filters by unit; -f streams new lines in real time (press Ctrl+C to exit).
journalctl -xe
Jump to recent errors with explanations Your #1 troubleshooting command when a service fails to start.
systemctl --failed
List all crashed or failed units Quickly spots any broken services across the entire server.

2 Web Servers (Nginx & Apache) Quick Reference

Web servers listen on ports 80 (HTTP) and 443 (HTTPS), serving static files or proxying requests to backend apps.

sudo nginx -t
Test Nginx syntax before reloading Checks every config file for typos. Always look for syntax is ok and test is successful.
sudo systemctl reload nginx
Apply Nginx config safely Run this right after nginx -t succeeds to load new server blocks.
sudo apache2ctl configtest
Test Apache syntax (Debian/Ubuntu) On RHEL/Rocky/Alma, use sudo httpd -t. Expect Syntax OK.
/etc/nginx/sites-available/
Where Nginx site configs live Store virtual host files here, then symlink them into /etc/nginx/sites-enabled/ to activate.

Port 80 vs Port 443

Port Protocol Encryption Modern Production Role
80 HTTP None (Plaintext) Used only to issue SSL certs (Let's Encrypt) and immediately 301 redirect to HTTPS.
443 HTTPS TLS / SSL Encrypted All live user traffic, logins, and APIs. Required by modern browsers.

HTTP Status Codes (What Actually Broke?)

Code Meaning Plain-English Diagnosis
200 OK Everything worked. The server returned the requested page or API response.
301 Moved Permanently Permanent redirect (e.g., http:// โ†’ https:// or old URL โ†’ new URL).
403 Forbidden Server understood the request but blocked access (check Linux file permissions or Nginx deny rules).
404 Not Found File or route doesn't exist at that URL (check root path or typo in URL).
502 Bad Gateway Nginx is alive, but the backend app (proxy_pass) is crashed or stopped. Check systemctl status app!
504 Gateway Timeout Backend app is running, but took too long to respond (slow DB query or frozen worker).

3 Windows Server & Active Directory

Essential CMD and PowerShell commands for diagnosing Domain Controllers, Group Policy (GPO), and user/computer accounts.

dcdiag
Domain Controller Health Check Tests DNS, replication, SYSVOL, and netlogon on a DC. Run in an elevated CMD/PowerShell.
gpupdate /force
Force Group Policy refresh now Re-applies all Computer & User GPOs immediately instead of waiting 90 minutes.
gpresult /r
Show applied Group Policies (RSOP) Displays which GPOs actually hit the machine/user and which DC authenticated you.
Get-ADUser -Identity jdoe -Properties *
Inspect an AD user (PowerShell) Shows account lockouts, password expiry, group memberships, and OU path.
Get-ADComputer -Filter *
List all domain-joined computers Filter with -Filter "Name -like 'SRV*'" to find servers quickly.

The 5 FSMO Roles (Flexible Single Master Operations)

While most AD tasks are multi-master, these 5 special roles must be held by only one Domain Controller at a time to prevent conflicts.

FSMO Role Scope What It Does
Schema Master Forest-wide (1 per Forest) Controls updates to the AD blueprint (new attributes/object classes).
Domain Naming Master Forest-wide (1 per Forest) Approves adding or removing domains in the AD forest.
PDC Emulator Domain-wide (1 per Domain) Master time source, handles password changes first, and locks out accounts.
RID Master Domain-wide (1 per Domain) Hands out pools of unique Relative IDs (RIDs) so DCs can create SIDs without duplicates.
Infrastructure Master Domain-wide (1 per Domain) Updates cross-domain group references (never put on a Global Catalog unless all DCs are GCs).

4 Cron Jobs & Scheduled Tasks Quick Syntax

Cron runs commands automatically on a schedule. Every standard cron line has 5 time fields followed by the command.

Field 1 * Minute (0โ€“59)
Field 2 * Hour (0โ€“23)
Field 3 * Day of Month (1โ€“31)
Field 4 * Month (1โ€“12)
Field 5 * Day of Week (0โ€“7)
Memory Trick: Think "Min, Hour, Day, Month, Weekday" โ€” units go from smallest to largest, with Weekday (0 or 7 = Sunday) at the end. Always use full paths (like /usr/bin/python3) inside cron!
@reboot /usr/local/bin/start-app.sh
Run once every time the server boots Handy shortcut for startup scripts without writing a full systemd unit.
0 2 * * * /usr/local/bin/backup.sh
Run daily at 2:00 AM Minute 0, Hour 2, every day, every month, every weekday.
*/5 * * * * /usr/local/bin/healthcheck.sh
Run every 5 minutes The */5 step syntax means "every 5th minute" (0, 5, 10, 15...).
crontab -e
Edit your user's cron table Use crontab -l to list current scheduled jobs safely without editing.

5 Danger Zone: Production Mistakes to Avoid

โš ๏ธ Stop & Think Before Running These on Live Servers
1. Using systemctl restart instead of reload on live traffic

restart kills all active worker processes and drops in-flight HTTP/API requests. Always prefer sudo systemctl reload nginx for config changes so existing connections finish cleanly.

2. Editing nginx.conf without running sudo nginx -t first

A single missing semicolon (;) will crash Nginx when you restart it, taking down every website on the server. Always test with nginx -t before reloading.

3. Running chmod -R 777 /var/www/html

777 gives every local user and compromised process full read, write, and execute rights. Use 755 for directories and 644 for web files instead.