在CentOS下使用yum命令默认安装的httpd版本,直接安装服务器安全狗Apache版本没有问题。
但是,如果Apache是自定义路径并且增加模块编译安装的,这个时候默认安装服务器安全狗Apache版本会报错,提示安装失败。
httpd-2.2.31
php-5.2.17
注意:咨询安全狗官方人员得到的回复是php版本太低,高版本的php直接安装不会有问题,这里是php-5.2.17的版本,其他的版本没试过。
解决办法:
1、下载安全狗
cd /usr/local/src
wget http://safedog.cn/safedog_linux64.tar.gz #下载安全狗64位版本
tar zxvf safedog_linux64.tar.gz #解压
cd /usr/local/src/safedog_linux64/install_files/safedogwz_linux64 #进入目录
vi install.sh #编辑修改,注释掉function find_apache()和function clean_install()这两个模块
#find apache
#function find_apache()
#{
# for progname in httpd apache2 apached
# do
# #find apache service
# testcmd="service "$progname" status"
# $testcmd>/dev/null 2>&1
# ret=$?
# if [ "$ret" == "0" ] || [ "$ret" == "2" ] || [ "$ret" == "3" ]; then
# g_ExistApache="true"
# g_ApacheExePath=$progname
# g_ApacheRestartCmd="service "$progname" restart"
# g_ApacheReloadCmd="service "$progname" graceful"
# g_ApacheStopCmd="service "$progname" stop"
# g_ApacheExeName=$progname
# get_apache_confpath
# if [ ! -z $g_ApacheConfPath ]; then
# return 1
# fi
# else
# testcmd="service "$progname" stop"
# $testcmd>/dev/null 2>&1
# ret=$?
# if [ "$ret" == "0" ]; then
# g_ExistApache="true"
# g_ApacheExePath=$progname
# g_ApacheRestartCmd="service "$progname" restart"
# g_ApacheReloadCmd="service "$progname" graceful"
# g_ApacheStopCmd="service "$progname" stop"
# g_ApacheExeName=$progname
# get_apache_confpath
# if [ ! -z $g_ApacheConfPath ]; then
# return 1
# fi
# fi
# fi
#
# #"find apache process"
# g_ApacheExePath=`ps -ef | grep $progname | grep -v grep | tail -3 | head -1 | awk '{print $8}'`
# if [ ! -z $g_ApacheExePath ];then
# g_ExistApache="true"
# g_ApacheRestartCmd=$g_ApacheExePath" -k restart"
# g_ApacheReloadCmd=$g_ApacheExePath" -k graceful"
# g_ApacheStopCmd=$g_ApacheExePath" -k stop"
# g_ApacheExeName=$progname
# return 1
# fi
#
# done
#
# # not found
# g_ExistApache="false"
#}
#function clean_install()
#{
# ./uninstall.sh 1 >/dev/null 2>&1
#}
:wq! #保存退出
2、安装安全狗
cd /usr/local/src/safedog_linux64
chmod +x *.py #添加执行权限
./install.py #安装
安装过程中,要求输入apache的模块路径
/usr/local/apache/bin
3、设置apache配置文件
vi /usr/local/apache/conf/httpd.conf #编辑
#Begin SafeDogSite-ApacheFilter edits - remove only on uninstall
Include "/etc/safedog/apache/SafeDogSiteApacheFilter.Conf"
LoadModule php5_module modules/libphp5.so #在配置文件中找到这一行,移动到安全狗配置文件的下面
service httpd restart #重启apache
service safedog status #查看安全狗状态
service safedog start #启动
service safedog stop #停止
至此,Linux服务器安全狗Apache版本安装完成。
(责任编辑:IT) |