Commands Cheat Sheet

Try DrDroid: AI Agent for Debugging

80+ monitoring tool integrations
Long term memory about your stack
Locally run Mac App available

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

Thank you for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.
Read more
Time to stop copy pasting your errors onto Google!

Access & Configuration

View Nginx Configuration
cat /etc/nginx/nginx.conf

Check Nginx Configuration Syntax
nginx -t

Reload Nginx Configuration
sudo nginx -s reload

Edit Nginx Configuration
sudo nano /etc/nginx/nginx.conf

View Site Configuration
cat /etc/nginx/sites-available/default

Status & Monitoring

Check Nginx Service Status
systemctl status nginx

Start Nginx Service
sudo systemctl start nginx

Stop Nginx Service
sudo systemctl stop nginx

Restart Nginx Service
sudo systemctl restart nginx

Enable Nginx to Start on Boot
sudo systemctl enable nginx

Check Nginx Process
ps aux | grep nginx

Logs

View Access Logs
tail -f /var/log/nginx/access.log

View Error Logs
tail -f /var/log/nginx/error.log

Search Access Logs
grep 'search-term' /var/log/nginx/access.log

Count Requests by IP
cat /var/log/nginx/access.log | awk '{print $1}' | sort | uniq -c | sort -nr

Performance & Connections

Check Open Connections
netstat -an | grep :80 | wc -l

Check Nginx Worker Processes
ps -ef | grep nginx | grep worker | wc -l

Check Nginx Listen Ports
netstat -tulpn | grep nginx

Metrics & Statistics

Enable Stub Status
Add 'location /nginx_status { stub_status on; }' to server block

View Stub Status
curl http://localhost/nginx_status

Count HTTP Status Codes
cat /var/log/nginx/access.log | cut -d '"' -f3 | cut -d ' ' -f2 | sort | uniq -c | sort -nr