To get a better idea of how my server for Weather was handling request, I needed a way to get some insights into nginx. I wanted to calculate request per second and routes being accessed. I came across a great tool call ngxtop, a real-time metrics for nginx server. After a few commands ngxtop was up and running on my Digital Ocean Forge server.
- Install ngxtop
pip install ngxtop
- On my forge server, I had to add ngxtop to my path
sudo nano ~/.bash_profile
- Then type and use ctrl +x to save
- Reload bash profile
- Finally I had to edit my Nginx Config on Forge and removed this line and restarted nginx
# access_log off
Some useful commands
- Run ngxtop
- View top source IPs of clients
ngxtop top remote_addr
- View 404 status codes
ngxtop -i 'status == 404'