中标麒麟linux下Apache编译安装步骤
中标麒麟linux v6.0自带的apache版本较低,已知的漏洞较多,不宜作为web 服务器,需更新到最新稳定版2.4.9,2.4.9版目前没有适合中标麒麟的rpm包,需通过源代码编译方式安装,本手册描述了源代码编译安装步骤,供项目负责人和部署实施人员参考。
查看默认安装apache版本方式
[root@localhost ~]# httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: Aug 7 2012 05:11:49
一、软件包准备
中标麒麟linux操作系统光盘或镜像
httpd-2.4.linux下gcc编译的四个步骤
#wget mirror.bit.edu/apache//httpd/httpd-2.4.
apr-1.5.
#wget mirrors.hust.edu/apache//apr/apr-1.5.
apr-util-1.5.
#wget mirrors.hust.edu/apache//apr/apr-util-1.5.
pcre-8.30.zip
#wget sourceforge/projects/pcre/files/pcre/8.30/pcre-8.30.zip/download
二、安装依赖包
1.配置光盘作为yum源。
2.通过yum安装、升级gcc编译器和libtool
#yum install gcc*
#yum install libtool*
3.安装pcre
#unzip pcre-8.30.zip
# cd pcre-8.30
# ./configure --prefix=/usr/local/pcre
#make
#make install
4.安装apr
#tar -zxvf apr-1.5.
#cd apr-1.5.1
#vim configure
到 $RM "$cfgfile"这行注释掉或者删除
# ./configure --prefix=/usr/local/apr
#make
#make install
5.安装apr-util
#tar -zxvf apr-util-1.5.
# cd apr-util-1.5.3
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr #make
#make install
三、编译安装apache
#tar -zxvf httpd-2.4.
#cd httpd-2.4.9
# ./configure --prefix=/usr/local/apache --enable-so \
--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util \
--with-pcre=/usr/local/pcre --enable-mods-shared=most \
--enable-proxy --enable-proxy-connect --enable-proxy-ftp \
--enable-proxy-http --enable-proxy-scgi --enable-proxy-ajp
--enable-proxy-balancer
#make
#make install
注意:以上所有软件配置和编译过程中有无报错信息。
编译安装后,先关闭系统自带版本apache,然后进入/usr/local/apache/conf 目录编辑f文件,到#LoadModule slotmem_shm_module
modules/mod_slotmem_shm.so这行把前面的注释去掉后保存,再进入
/usr/local/apache/bin启动新版本,启动后使用浏览器访问服务器IP地址检查是否安装成功。
#service httpd stop
#cd /usr/local/apache/bin
#./apachectl -k start
验证安装成功后删除系统自带apache
#chkconfig httpd off
#yum remove httpd
注意:端口不要与Apusic的端口发生冲突
四、配置apache
#cd /usr/local/apache/conf
#vim f
修改端口号
Listen 9090 //注意修改为实际端口,这里以9090为例
并添加一下内容。
>>>>>>>>
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
</IfModule>
<IfModule worker.c>
StartServers 4
MaxClients 300
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
Timeout 60
KeepAlive Off
ServerTokens Prod
HostnameLookups Off
ServerSignature Off
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0 BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
#NameVirtualHost *:9090
<VirtualHost *:9090> //注意修改为实际端口
ServerAdmin ample
DocumentRoot /usr/local/apache/htdocs
# ServerName ***
ProxyPass /images !
ProxyPass /html !
ProxyPass /img !
ProxyPass /js !
ProxyPass /docs !
ProxyPass /css ! //不需要代理的目录
ProxyPass /app 192.168.1.100/app //注意修改为应用服务器实际IP
ProxyPassReverse /app 192.168.1.100/app
ErrorLog "|/usr/local/apache/bin/rotatelogs
/usr/local/apache/logs/error_log 86400"
CustomLog "|/usr/local/apache/bin/rotatelogs
/usr/local/apache/logs/access_log 86400" common
</VirtualHost>
TraceEnable off
配置完成后,将各站点目录复制到/usr/local/apache/htdoc目录下并删除该目
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
ubuntu常用代码
« 上一篇
发表评论