iptables并发数控制:
vi /etc/modprobe.d/xt_recent.conf
options xt_recent ip_list_tot=1024 ip_pkt_list_tot=200
modprobe xt_recent
iptables -I INPUT -p tcp --dport 80 -m state --state NEW -s -j ACCEPT
iptables -I INPUT -p tcp --dport 80 -m state --state NEW -m recent --set
iptables -I INPUT -p tcp --dport 80 -m state --state NEW -m recent --update --seconds 60 --hitcount 200 -j DROP
service iptables save
service iptables restart
/proc/net/xt_recent/
echo +addr >/proc/net/xt_recent/DEFAULT
to add addr to the DEFAULT list
echo -addr >/proc/net/xt_recent/DEFAULT
to remove addr from the DEFAULT list
echo / >/proc/net/xt_recent/DEFAULT
to flush the DEFAULT list (remove all entries).
enable memcached for php on apache:
Enable EPEL repository
yum -y install memcached php-pecl-memcache
vi /etc/sysconfig/memcached
# Running on Port 11211
PORT="11211"
# Start as memcached daemon
USER="memcached"
# Set max simultaneous connections to 1024
MAXCONN="1024"
# Set Memory size to 2048 - 4GB(4096)
CACHESIZE="2048"
#Set server IP address
OPTIONS="-l 127.0.0.1"
service memcached start; chkconfig memcached on
service httpd restart
memcached-tool 127.0.0.1 stats
check web status:
vi httpcheck.sh
while true; do
dns=`curl -o /dev/null -s -w %{http_code} www.xxx.com`
echo "$(date) This is for DNS name,status code is $dns"
if [ $dns -ne 200 ]; then
echo "problem"
fi
ip=`curl -o /dev/null -s -w %{http_code} x.x.x.x `
echo "$(date) This is for IP name,status code is $ip"
if [ $ip -ne 200 ]; then
echo "problem"
fi
sleep 60
done