Showing posts with label webserver. Show all posts
Showing posts with label webserver. Show all posts

Wednesday, April 16, 2008

IPs most accessing your Apache

Here's a command using which you can find out what IPs are accessing your http server Apache most from its log file.

cat log | grep "GET /" | awk '{print $1}' | sort | uniq -c | sort -rn | less


It is useful in a case of DDoS attack, when you want to know these IPs and ban them in your firewall.

Tuesday, December 25, 2007

nginx could not build the server_names_hash hash

When restarting nginx, suddenly I came accross this error message:

could not build the server_names_hash hash, you should increase server_names_hash_bucket_size: 32

Now, that's solved pretty easily - by increasing server_names_hash_bucket in config file to a bigger value. According to author, Igor Sysoev, even p4 can easily handle value of a 128.

So I put
server_names_hash_bucket_size 128;
in nginx.conf, and everything works fine.



Friday, November 9, 2007

Pass real IP for backend webserver

The problem: when nginx is serving front end in two layer webserver, with apache on backend, apache doesn't see clients ip address, just 127.0.0.1 for everybody.

The solution: install either mod_realip (apache 1.3.x only) or mod_rpaf (both apache 1.3.x and 2).

http://sysoev.ru/mod_realip/ - mod_realip
http://stderr.net/apache/rpaf/ - mod_rpaf

http://nginx.info/index.pl/ru/articles