How to monitor incoming http requests

monitoringweb

How can I monitor incoming HTTP requests to port 80? I have set up web hosting on my local machine using DynDNS and Nginx. I wanted to know how many request are made on my server every day.

Currently I'm using this command:

netstat -an | grep 80

Best Answer

You may use tcpdump.

# tcpdump filter for HTTP GET 
sudo tcpdump -s 0 -A 'tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420'

# tcpdump filter for HTTP POST 
sudo tcpdump -s 0 -A 'tcp dst port 80 and (tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x504f5354)'

For a solution using tshark see:

https://serverfault.com/questions/84750/monitoring-http-traffic-using-tcpdump

Related Question