Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am hosting a web server with and I want to view all the incoming connections that are going to my nginx web-server. I am running Ubuntu system and I can't seem to find anything like this. I don't know if nginx has something built in like this. And to go ahead and clear up some options I do not want to do would be logging them in some sort of database. Thanks for the help!

share|improve this question
up vote 0 down vote accepted

You should monitor the access log of nginx, all the incoming connection to web request you can see there. There is a httplogmodule that you can see if that is enabled in your configuration otherwise you can enable it. for more details of the nginx httplogmodule, see here.

Access log path should be defined as follows so you can see the location of the file.

access_log /spool/logs/nginx-access.log gzip buffer=32k;

If above is the path of the access file, you can monitor via tail command.

# tail -f /spool/logs/nginx-access.log

share|improve this answer

I don't understand your question, do you want to log - or not?

If you don't want to log

If you just want a quick overview of connected IP's - you can use

netstat -atun | grep -E ":(80|443)" | awk '{print $5}' | cut -d: -f1 | sort -u -k1,1

If you wanted to know the number of connections by IP - you can use

netstat -atun | grep -E ":(80|443)" | awk '{print $5}' | cut -d: -f1 | sed -e '/^$/d' |sort | uniq -c | sort -n

If you want to log

You could use IP tables (the log would be /var/log/messages or /var/log/syslog)

iptables -A INPUT -p udp --dport 80 -j LOG
iptables -A INPUT -p udp --dport 443 -j LOG

You could use Nginx itself, see

access_log /var/log/nginx-access.log;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.