← Back to Home

Documentation Hub

Nginx Routing & Linux Server Guides

🌐

Nginx Basics

Common Location Blocks

location / {
    root /var/www/html;
    index index.html;
}

location /abc {
    alias /var/www/html/abc.html;
    try_files $uri =404;
}

location /xyz {
    alias /var/www/html/xyz.html;
    try_files $uri =404;
}

Useful Directives

  • proxy_pass — Reverse proxy
  • rewrite — URL rewriting
  • try_files — File existence check
  • return 301 — Permanent redirect
🐧

Essential Linux Commands

System Update

sudo apt update && sudo apt upgrade -y

Check Nginx Status

sudo systemctl status nginx

Test Nginx Config

sudo nginx -t

View Logs

sudo tail -f /var/log/nginx/access.log

💡 Pro Tips for NGINX Routing

1.

Use try_files $uri =404; to return clean 404 errors

2.

Always test config with sudo nginx -t before reloading

3.

Reload Nginx without downtime: sudo systemctl reload nginx

This page is served via Nginx location block: /pqr