LAMP调优
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LAMP调优相关的知识,希望对你有一定的参考价值。
LAMP调优
- 屏蔽apache版本信息
[[email protected] extra]# vim /usr/local/apache2.4/conf/extra/httpd-default.conf //搜索 ServerTokens Full
[[email protected] extra]# vim /usr/local/apache2.4/conf/extra/httpd-vhosts.conf //加上以下两行
ServerTokens Prod
ServerSignature Off
再次查看版本
编译之前进行如下操作,或进行重新编译,修改源码包下 include 目录下的 ap_releash.h 文件
[[email protected] httpd-2.4.25]# cd /usr/local/src/
[[email protected] httpd-2.4.25]# rm -rf httpd-2.4.25
[[email protected] httpd-2.4.25]# tar zxvf httpd-2.4.25.tar.gz
[[email protected] httpd-2.4.25]# cd httpd-2.4.25/
[[email protected] httpd-2.4.25]# vim include/ap_release.h
#define AP_SERVER_BASEVENDOR "apenglinux" //服务的供应商名称
#define AP_SERVER_BASEPROJECT "web server" //服务的项目名称
#define AP_SERVER_BASEPRODUCT "web" //服务的产品名
#define AP_SERVER_MAJORVERSION_NUMBER 8 //主要版本号
#define AP_SERVER_MINORVERSION_NUMBER 1 //小版本号
#define AP_SERVER_PATCHLEVEL_NUMBER 2 //补丁级别
#define AP_SERVER_DEVBUILD_BOOLEAN 3 //
注:修改成自己想要的,然后编译安装之后,再对 httpd-default.conf 进行修改,对方就彻底不知道你的版本号了。
源码编译安装apache
[[email protected] httpd-2.4.25]# yum install openssl*
[[email protected] httpd-2.4.25]# ./configure --prefix=/usr/local/apache2.4-apeng --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-rewrite --enable-ssl --enable-mods-shared=most
--prefix=/usr/local/apache2.4-apeng //指定安装路径
--enable-so //支持动态加载模块
--enable-rewrite //支持网站地址重定
--enable-ssl //支持ssl加密
[[email protected] httpd-2.4.25]# make -j 4 //以4核同时编译 4个进程
[[email protected] httpd-2.4.25]# make install
[[email protected] httpd-2.4.25]# ls /usr/local/apache2.4-apeng/htdocs/
[[email protected] httpd-2.4.25]# ls /usr/local/apache2.4-apeng/conf/httpd.conf
[[email protected] httpd-2.4.25]# echo apache2.4-apeng >> /usr/local/apache2.4-apeng/htdocs/index.html
[[email protected] httpd-2.4.25]# cp /usr/local/apache2.4-apeng/bin/apachectl /etc/init.d/apachectl-apeng
[[email protected] httpd-2.4.25]# /usr/local/apache2.4/bin/apachectl stop
[[email protected] httpd-2.4.25]# vim /etc/init.d/apachectl-apeng //加上以下两行
# chkconfig: 2345 64 36
# description: apache-apeng
[[email protected] httpd-2.4.25]# chkconfig --add apachectl-apeng
[[email protected] httpd-2.4.25]# chkconfig --list apachectl-apeng
apachectl-apeng 0:关 1:关 2:开 3:开 4:开 5:开 6:关
以上是关于LAMP调优的主要内容,如果未能解决你的问题,请参考以下文章