Intermediate · 20 lessons
Linux
Linux powers over 96% of web servers worldwide. From shared hosting to cloud giants, Linux provides stability, security, and flexibility. Mastering the command line, file system, permissions, and services is essential for anyone managing servers.
Key Concepts
Key Takeaways
- ✓ Linux is the standard OS for web servers, cloud VMs, and containers.
- ✓ SSH with key-based auth is the secure way to manage remote servers.
- ✓ Understand file permissions — wrong chmod causes 403 errors and security holes.
- ✓ Use systemd to manage services like Nginx, MySQL, and PHP-FPM.
Lessons in This Topic
Linux for Web Servers
Why Linux dominates hosting infrastructure.
Linux is free, open-source, stable, and secure. Most hosting stacks (LAMP/LEMP) run on Linux. Cloud providers offer Linux VMs by default. Android is Linux-based. Learning Linux opens careers in sysadmin, DevOps, and cloud engineering.
Essential Command Line Tools
Navigate, search, and manage files efficiently.
Key commands: ls (list), cd (change dir), cp/mv/rm (copy/move/delete), cat/less (view files), grep (search text), find (locate files), tar (archives), wget/curl (download). Pipe commands together: `grep "error" /var/log/nginx/error.log | tail -20`.
SSH & Remote Server Access
Connect securely and manage servers remotely.
Generate key pair: `ssh-keygen -t ed25519`. Copy public key to server: `ssh-copy-id user@server`. Connect: `ssh user@server`. Disable password auth in /etc/ssh/sshd_config for security. Use SSH config (~/.ssh/config) for aliases and jump hosts.
File Permissions & Ownership
chmod, chown, and the rwx model.
Permissions: read (r=4), write (w=2), execute (x=1) for owner/group/others. `chmod 755` for directories, `644` for files. Web files often owned by www-data. Wrong permissions cause 403 Forbidden or security vulnerabilities. Use `ls -la` to inspect.
Web Server Stack Setup (LEMP)
Install Nginx, MySQL, PHP on Ubuntu.
Standard flow: apt update → install nginx → install mysql-server → install php-fpm → configure nginx server block → create database → deploy app. Use Certbot for free Let's Encrypt SSL. Test with `nginx -t` before reloading config.
Logs, Monitoring & Cron
Keep servers healthy and automated.
Important logs: /var/log/nginx/, /var/log/mysql/, journalctl -u nginx. Cron schedules tasks: backups, cert renewal, cache clearing. Syntax: `0 2 * * * /path/to/backup.sh` runs at 2 AM daily. Monitor disk space — logs fill disks silently.
