Nginx Commands

Rahul Das
08/03/2025

This is a post for describing few nginx commands

Here are some common Nginx commands for managing the server:

1. Start, Stop, and Restart Nginx

sudo systemctl start nginx    # Start Nginx
sudo systemctl stop nginx     # Stop Nginx
sudo systemctl restart nginx  # Restart Nginx (hard restart)
sudo systemctl reload nginx   # Reload without dropping connections

2. Check Nginx Status

sudo systemctl status nginx  # Check if Nginx is running

3. Test Nginx Configuration

sudo nginx -t   # Test for syntax errors

4. Enable/Disable Nginx on Boot

sudo systemctl enable nginx   # Enable auto-start on boot
sudo systemctl disable nginx  # Disable auto-start on boot

5. View Nginx Logs

sudo tail -f /var/log/nginx/access.log  # View access logs
sudo tail -f /var/log/nginx/error.log   # View error logs

6. Reload Configuration without Restarting

sudo systemctl reload nginx

7. Check Running Nginx Processes

ps aux | grep nginx

8. Stop All Nginx Processes

sudo pkill nginx

9. Find Active Nginx Configuration Files

nginx -T   # Show all active configuration files

Let me know if you need any specific Nginx command details! 🚀

Share this post