Catalogue / Infrastructure & systems
Nginx and Apache Web Servers in Production
Run nginx and Apache the way companies do — virtual hosts, rewrites, reverse proxy, caching, TLS, security headers, performance and troubleshooting 502/504 errors.
A MasterLinux course · Original text
What you will learn
- Read the configuration an nginx or Apache server has actually loaded, includes and all
- Write clean virtual hosts with a default block that rejects unknown names
- Master location order, try_files, return and rewrite without redirect loops
- Put nginx in front of an application as a reverse proxy, with the right headers and timeouts
- Set up an nginx cache that protects the application during an outage or a traffic spike
- Run Apache 2.4 with the event MPM, PHP-FPM and mod_rewrite
- Configure modern TLS (TLS 1.2/1.3, HTTP/2, HSTS) and follow Let's Encrypt's 2025 changes
- Add security headers that do not disappear, and rate-limit each client
- Tune workers, file descriptors and keepalive to handle the load
- Troubleshoot a 502 or 504 by reading the logs, then deliver a complete website
Course content
11 lessons · 7 h 45 minSection 1 — Fundamentals
Section 2 — Proxy, cache and Apache
- nginx as a reverse proxy — proxy_pass and its slash, forwarded headers, timeouts, WebSocket and the real client IP 40 min
- The nginx cache — proxy_cache, stale content during an outage, stampede lock and logged-in users 40 min
- Apache 2.4 in production — MPM event, PHP-FPM, AllowOverride None and mod_rewrite in the virtual host 40 min
- TLS in production — HTTP/2, modern protocols, full chain, HSTS and the end of OCSP at Let's Encrypt 40 min
Section 3 — Security and performance
- Security headers and rate limiting — the add_header inheritance trap, limit_req and limit_conn 40 min
- Performance — workers, connections, file descriptors, LimitNOFILE, keepalive and compression 40 min
- Logs and diagnosis — log_format with response times, reading a 502 or a 504, finding the faulty server 40 min
Requirements
- The “Fundamentals” course or solid hands-on experience with the Linux command line
- Having already set up a simple web server (Debian or Ubuntu web server lessons)
- Basic knowledge of HTTP (methods, status codes, headers) and DNS
Who is this course for?
- System administrators who run websites and APIs in production
- DevOps and SRE engineers who operate reverse proxies
- Students and junior engineers aiming for an operations job at an IT services company