+--------------------------------------------------------------+
| ===WelcometoTunoffservices=== |
+--------------------------------------------------------------+
EOF
#---------------------------------------------------------------------------------
foriin`ls/etc/rc3.d/S*`
do
CURSRV=`echo$i|cut-c15-`
echo$CURSRV
case$CURSRVin
crond|irqbalance|microcode_ctl|network|random|sendmail|sshd|syslog|local|mysqld)
echo"Baseservices,Skip!
"
;;
*)
echo"change$CURSRVtooff"
chkconfig--level235$CURSRVoff
service$CURSRVstop
;;
esac
done
1.4系统环境部署及调整
检查系统是否正常
#tail-n100/var/log/messages (检查有无系统级错误信息)
#dmesg (检查硬件设备是否有错误信息)
#ifconfig (检查网卡设置是否正确)
#pingwww.linuxtone.org (检查网络是否正常)
1.5使用yum程序安装所需开发包
1.5.1更换快源
#cd/etc/yum.repos.d/
#mvCentOS-Base.repoCentOS-Base.repo.linuxtone
#wgethttp:
//docs.linuxtone.org/soft/lemp/CentOS-Base.repo
1.5.2yum安装相关软件包:
#yum-yinstallntpvim-enhancedgccgcc-c++gcc-g77flexbisonautoconfautomakeglibcglibc-develglib2glib2-develbzip2bzip2-develncursesncurses-devellibtool*zlib-devellibxml2-devellibjpeg-devellibpng-devellibtiff-develfontconfig-develfreetype-devellibXpm-develgettext-develcurlcurl-develpam-devele2fsprogs-develkrb5-devellibidnlibidn-developensslopenssl-developenldapopenldap-develnss_ldapopenldap-clientsopenldap-servers
1.6定时校正服务器时钟,定时与中国国家授时中心授时服务器同步
#crontab-e
加入一行:
153***/usr/sbin/ntpdate210.72.145.44>/dev/null2>&1
1.7下载相关软件包
#cd/usr/local/src
#vilist_tar.list
http:
//docs.linuxtone.org/soft/lemp/ImageMagick.tar.gz
http:
//docs.linuxtone.org/soft/lemp/PDO_MYSQL-1.0.2.tgz
http:
//docs.linuxtone.org/soft/lemp/eaccelerator-0.9.5.3.tar.bz2
http:
//docs.linuxtone.org/soft/lemp/imagick-2.2.2.tgz
http:
//docs.linuxtone.org/soft/lemp/libiconv-1.13.tar.gz
http:
//docs.linuxtone.org/soft/lemp/libmcrypt-2.5.8.tar.gz
http:
//docs.linuxtone.org/soft/lemp/mcrypt-2.6.8.tar.gz
http:
//docs.linuxtone.org/soft/lemp/memcache-2.2.5.tgz
http:
//docs.linuxtone.org/soft/lemp/mhash-0.9.9.9.tar.gz
http:
//docs.linuxtone.org/soft/lemp/mysql-5.1.34.tar.gz
http:
//docs.linuxtone.org/soft/lemp/pcre-7.8.tar.gz
http:
//docs.linuxtone.org/soft/lemp/php-5.2.9.tar.bz2
http:
//sysoev.ru/nginx/nginx-0.8.21.tar.gz
http:
//docs.linuxtone.org/soft/lemp/ZendOptimizer-3.3.3-linux-glibc23-x86_64.tar.gz
#wget-ilist_tar.list
1.8.添加nginx运维账户:
#viadd_webuser.sh
/usr/sbin/groupaddwww
/usr/sbin/useradd-gwwwwww
mkdir-p/data/www/wwwroot
chmod+w/data/www/wwwroot
chownwww:
www/data/www/wwwroot-R
#shadd_webuser.sh
二.编译安装
2.1编译安装pcre
#tarzxvfpcre-7.8.tar.gz
#cdpcre-7.8
#./configure&&make&&makeinstall
2.2编译安装nginx
#tarzxvfnginx-0.8.21.tar.gz
#cdnginx-0.8.21
2.2.1附加:
修改nginx源代码,伪装nginx服务器(仅供参考,安全还得认真做起^.^):
(1).修改gcc
#viauto/cc/gcc
NGX_GCC_OPT="-O"
修改为:
NGX_GCC_OPT="-O3"
(2).修改nginx.h
#vinginx-0.8.21/src/core/nginx.h
#defineNGINX_VERSION "0.7.58"
#defineNGINX_VER "nginx/"NGINX_VERSION
修改为:
#defineNGINX_VERSION "1.0"
#defineNGINX_VER "LTWS/"NGINX_VERSION
(3).修改nginx_http_header_filter_module
#vinginx-0.8.21/src/http/ngx_http_header_filter_module.c
staticcharngx_http_server_string[]="Server:
nginx"CRLF;
修改为:
staticcharngx_http_server_string[]="Server:
LTWS"CRLF;
(4).修改ngx_http_special_response.c
#vinginx-0.8.21/src/http/ngx_http_special_response.c
将如下
staticu_charngx_http_error_full_tail[]=
"
"NGINX_VER""CRLF