May 312011

Sometimes, we prefer to view statistics in graphical form rather than numerical values​​, which is not too attractive to be displayed. Nginx supports stub_status directive module, which we can use to print:

  • Active connections
  • Server accepts handled requests
  • Reading
  • Writing
  • Waiting

For example:

Active connections: 6
server accepts handled requests
 15561 15561 26602
Reading: 4 Writing: 2 Waiting: 0

However, This module is not compiled by default and must be specified using this argument when compiling nginx.


First, to get statistics like the above example, you should modify nginx config file and add location directive this

server {
	location /nginx_status {
		stub_status on;
		access_log   off;
		deny all;

perl scripts used to generate statistical images can be downloaded here:

Rename to and make it executable
Continue reading »

May 292011

If you intend to be able to reject connections from remote IP addresses if they’re from certain countries. This is how you do it. This method will reject ip address that has been mapped in GeoIP at smtp conversation stage. However, This tutorial has never been tested. nothing more than a prototype that i created in leisure time.

Software required:

  • postfix (tcp_table)
  • Perl
  • Perl Geo::IP module = 3600s
smtpd_client_restrictions =
	check_client_access tcp:[]:2528 inet  n       n       n       -       0      spawn
	user=nobody argv=/etc/postfix/

Continue reading »