# iptables -F
# iptables -P INPUT ACCEPT
# iptables -P OUTPUT ACCEPT
# iptables -P FORWARD ACCEPT
# iptables -A FORWARD -s 124.115.0.0/24 -j DROP
# iptables -I FORWARD -d 202.96.170.164 -j DROP
补充::
单个IP的命令是
iptables -I INPUT -s 124.115.0.199 -j DROP
封IP段的命令是
iptables -I INPUT -s 124.115.0.0/16 -j DROP
iptables -I INPUT -s 124.115.3.0/16 -j DROP
iptables -I INPUT -s 124.115.4.0/16 -j DROP
封整个段的命令是
iptables -I INPUT -s 124.115.0.0/8 -j DROP
封几个段的命令是
iptables -I INPUT -s 61.37.80.0/24 -j DROP
iptables -I INPUT -s 61.37.81.0/24 -j DROP
用iptables禁止一个IP地址范围
iptables -A FORWARD -s 10.0.0.1-255 -j DROP
用防火墙禁止(或丢弃) icmp 包
iptables -A INPUT -p icmp -j DROP
# iptables -P INPUT ACCEPT
# iptables -P OUTPUT ACCEPT
# iptables -P FORWARD ACCEPT
# iptables -A FORWARD -s 124.115.0.0/24 -j DROP
# iptables -I FORWARD -d 202.96.170.164 -j DROP
补充::
单个IP的命令是
iptables -I INPUT -s 124.115.0.199 -j DROP
封IP段的命令是
iptables -I INPUT -s 124.115.0.0/16 -j DROP
iptables -I INPUT -s 124.115.3.0/16 -j DROP
iptables -I INPUT -s 124.115.4.0/16 -j DROP
封整个段的命令是
iptables -I INPUT -s 124.115.0.0/8 -j DROP
封几个段的命令是
iptables -I INPUT -s 61.37.80.0/24 -j DROP
iptables -I INPUT -s 61.37.81.0/24 -j DROP
用iptables禁止一个IP地址范围
iptables -A FORWARD -s 10.0.0.1-255 -j DROP
用防火墙禁止(或丢弃) icmp 包
iptables -A INPUT -p icmp -j DROP
错误描述
BEGIN failed--compilation aborted at Makefile.PL line 24.
make[1]: *** [PerlMagick/Makefile] Error 2
make[1]: Leaving directory `/root/ImageMagick-6.4.9-10'
make: *** [all] Error 2
在安装ImageMagick出现这个错误!可能是没安装perl-CPAN
运行:
yum -y install perl-CPAN
这个命令之后再重新编译一下试试看!
我的环境是centos6
BEGIN failed--compilation aborted at Makefile.PL line 24.
make[1]: *** [PerlMagick/Makefile] Error 2
make[1]: Leaving directory `/root/ImageMagick-6.4.9-10'
make: *** [all] Error 2
在安装ImageMagick出现这个错误!可能是没安装perl-CPAN
运行:
yum -y install perl-CPAN
这个命令之后再重新编译一下试试看!
我的环境是centos6
PHP的安装虽然有时候很简单,可是如果应用一多,我们安装起来就很头痛了!常见的就是PHP插件的安装问题最多了!
其实不管是你是Apache类的应用还是Nginx类的.PHP的安装都不是很简单,虽然网上很多configure,但是那不一定是适合你的,因为很多都直接关系着你的系统及系统版本和内核.那下面就进入正题
首先来一个最常见的就是configure: error: libjpeg.(a|so) not found
其实不管是你是Apache类的应用还是Nginx类的.PHP的安装都不是很简单,虽然网上很多configure,但是那不一定是适合你的,因为很多都直接关系着你的系统及系统版本和内核.那下面就进入正题
首先来一个最常见的就是configure: error: libjpeg.(a|so) not found
方法1
使用文本编辑工具打开 /etc/selinux/config
把 SELINUX=enforcing 注释掉:#SELINUX=enforcing ,然后新加一行为:SELINUX=disabled
保存,关闭。
重启系统。
方法2
我们经常由于默认系统的安全性配置导致些莫名其妙的问题,比如SElinux本来是用于安全子系统的权限控制,可是搞不好就发现限制多多,我们可以用如下方法快速关闭SElinux
使用文本编辑工具打开 /etc/selinux/config
把 SELINUX=enforcing 注释掉:#SELINUX=enforcing ,然后新加一行为:SELINUX=disabled
保存,关闭。
重启系统。
方法2
我们经常由于默认系统的安全性配置导致些莫名其妙的问题,比如SElinux本来是用于安全子系统的权限控制,可是搞不好就发现限制多多,我们可以用如下方法快速关闭SElinux
eaccelerator.shm_size=”32″
eAccelerator 可以使用的共享内存的数量 (以兆为单位) . “0″ 是指操作系统的默认值. 默认值是 “0″.可根据服务器的实际情况来调整,16,32,64,128都是可以的。
eaccelerator.cache_dir=”/home/php/tmp”
这个目录是给磁盘缓存使用. eAccelerator 在这里储存预先编译好的代码, 进程数据, 内容以及用户的自定义内容. 同样的数据也能被储存在共享内存中 (这样可以提高访问速度). 默认的设置是 “/tmp/eaccelerator”.
eaccelerator.enable=”1″
开启或关闭 eAccelerator。”1″ 为开启,”0″ 为关闭。默认值为 “1″。
eaccelerator.optimizer=”1″
启或关闭内部优化器,可以提升代码执行速度。”1″ 为开启,”0″ 为关闭。默认值为 “1″。
eAccelerator 可以使用的共享内存的数量 (以兆为单位) . “0″ 是指操作系统的默认值. 默认值是 “0″.可根据服务器的实际情况来调整,16,32,64,128都是可以的。
eaccelerator.cache_dir=”/home/php/tmp”
这个目录是给磁盘缓存使用. eAccelerator 在这里储存预先编译好的代码, 进程数据, 内容以及用户的自定义内容. 同样的数据也能被储存在共享内存中 (这样可以提高访问速度). 默认的设置是 “/tmp/eaccelerator”.
eaccelerator.enable=”1″
开启或关闭 eAccelerator。”1″ 为开启,”0″ 为关闭。默认值为 “1″。
eaccelerator.optimizer=”1″
启或关闭内部优化器,可以提升代码执行速度。”1″ 为开启,”0″ 为关闭。默认值为 “1″。
在你配置的NGINX nginx.conf中加入如下代码
log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /home/wwwlogs/access.log access;
error_log logs/nginx_error.log debug;
error_page 404 = /404.php;
error_log 日志分为
nginx的log有以下几种类型: [ debug | info | notice | warn | error | crit ]
在nginx.conf的设置:error_log logs/error.log debug;
debug 为最详细 crit最少
在页面里使用 error_log('this is error log') 方法方便调试程序
log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /home/wwwlogs/access.log access;
error_log logs/nginx_error.log debug;
error_page 404 = /404.php;
error_log 日志分为
nginx的log有以下几种类型: [ debug | info | notice | warn | error | crit ]
在nginx.conf的设置:error_log logs/error.log debug;
debug 为最详细 crit最少
在页面里使用 error_log('this is error log') 方法方便调试程序
有些时候,总是很害怕自己的网站文件有没有被人修改过,害怕被人放了新的恶意文件进来。于是,经常翻动各个文件夹去看最后修改时间什么的,费时又费力,而且最后修改时间也不一定是准确的。
在Linux下面,有一个软件可以帮我们做到24小时不间断的监控文件改动,就是inotify-tools。只要是内核版本在2.6.13以上的系统都可以用,比如CentOS 5 。
安装步骤:
1,下载
wget --no-check-certificate http://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz
2,编译
tar zxf inotify-tools-3.14.tar.gz
cd inotify-tools-3.14
./configure
make
make install
3,一些小处理
如果是32位系统
ln -s /usr/local/lib/libinotifytools.so.0 /usr/lib/libinotifytools.so.0
如果是64位系统
ln -s /usr/local/lib/libinotifytools.so.0 /usr/lib64/libinotifytools.so.0
无论32或者64位系统都执行
echo 104857600 > /proc/sys/fs/inotify/max_user_watches
echo 'echo 104857600 > /proc/sys/fs/inotify/max_user_watches' >> /etc/rc.local
使用办法:
inotifywait -m -r -d -o/var/log/change.log --timefmt '%F %T' --format '%T %w%f %e' -e close_write -e create /home/www
其中/var/log/change.log是日志路径,/home/www是监控的网站路径
在Linux下面,有一个软件可以帮我们做到24小时不间断的监控文件改动,就是inotify-tools。只要是内核版本在2.6.13以上的系统都可以用,比如CentOS 5 。
安装步骤:
1,下载
wget --no-check-certificate http://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz
2,编译
tar zxf inotify-tools-3.14.tar.gz
cd inotify-tools-3.14
./configure
make
make install
3,一些小处理
如果是32位系统
ln -s /usr/local/lib/libinotifytools.so.0 /usr/lib/libinotifytools.so.0
如果是64位系统
ln -s /usr/local/lib/libinotifytools.so.0 /usr/lib64/libinotifytools.so.0
无论32或者64位系统都执行
echo 104857600 > /proc/sys/fs/inotify/max_user_watches
echo 'echo 104857600 > /proc/sys/fs/inotify/max_user_watches' >> /etc/rc.local
使用办法:
inotifywait -m -r -d -o/var/log/change.log --timefmt '%F %T' --format '%T %w%f %e' -e close_write -e create /home/www
其中/var/log/change.log是日志路径,/home/www是监控的网站路径
通过命令查看服务器上一共开了多少的 php-cgi 进程
ps -fe |grep "php"|grep -v "grep"|wc -l
查看已经有多少个php-cgi进程用来处理tcp请求
netstat -anop |grep "php"|grep -v "grep"|wc -l
1个Nginx进程占用11M物理内存,5个php-cgi进程每个占用8M左右物理内存,1个MySQL服务器占用7M物理内存
ps -fe |grep "php"|grep -v "grep"|wc -l
查看已经有多少个php-cgi进程用来处理tcp请求
netstat -anop |grep "php"|grep -v "grep"|wc -l
1个Nginx进程占用11M物理内存,5个php-cgi进程每个占用8M左右物理内存,1个MySQL服务器占用7M物理内存
Sphinx是一个很好的全文可检索软件,它支持MySQL和PGSQL.
一般来说Sphinx原版对英文全文检索校好,但对中文全文检索的话,就使用国人的修改版coreseek了.
coreseek安装比较麻烦一些.是我的安装记录:
一般来说Sphinx原版对英文全文检索校好,但对中文全文检索的话,就使用国人的修改版coreseek了.
coreseek安装比较麻烦一些.是我的安装记录:
一、源码包准备
服务器端主要是安装memcache服务器端,目前的最新版本是 memcached-v1.4.4 。
下载:http://memcached.googlecode.com/files/memcached-1.4.4.tar.gz
另外,Memcache用到了libevent这个库用于Socket的处理,所以还需要安装libevent,
libevent的最新版本是libevent-1.4.13-stable。(如果你的系统已经安装了libevent,可以不用安装)
官网:http://www.monkey.org/~provos/libevent/
下载:http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz
服务器端主要是安装memcache服务器端,目前的最新版本是 memcached-v1.4.4 。
下载:http://memcached.googlecode.com/files/memcached-1.4.4.tar.gz
另外,Memcache用到了libevent这个库用于Socket的处理,所以还需要安装libevent,
libevent的最新版本是libevent-1.4.13-stable。(如果你的系统已经安装了libevent,可以不用安装)
官网:http://www.monkey.org/~provos/libevent/
下载:http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz