Nginx Routing & Linux Server Guides
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;
}
proxy_pass — Reverse proxyrewrite — URL rewritingtry_files — File existence checkreturn 301 — Permanent redirectSystem 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
Use try_files $uri =404; to return clean 404 errors
Always test config with sudo nginx -t before reloading
Reload Nginx without downtime: sudo systemctl reload nginx
/pqr