Setup Guide

Install Nginx

Installs the latest stable version of Nginx from the official Debian repositories:

sudo apt update
sudo apt install nginx

Configure Firewall

Sets up firewall rules to allow HTTP (80) and HTTPS (443) traffic:

sudo ufw allow 'Nginx Full'
sudo ufw status

Common Commands

Essential commands for managing Nginx service:

# Test configuration syntax
sudo nginx -t

# Service control
sudo systemctl start nginx      # Start service
sudo systemctl stop nginx       # Stop service
sudo systemctl restart nginx    # Full restart
sudo systemctl reload nginx     # Reload config without dropping connections

# Check service status
sudo systemctl status nginx

Directory Structure

Key directories and their purposes:

  • /etc/nginx: Main configuration directory
  • /etc/nginx/sites-available: Individual site configurations
  • /etc/nginx/sites-enabled: Active site configurations (symlinks)
  • /var/log/nginx: Log files location
  • /var/www: Web content root directory