红联Linux门户
Linux帮助

在基于Window Azure云服务器CentOS6.5下安装Apache2.4.9服务

发布时间:2015-04-08 15:17:37来源:linux网站作者:yakson

今天以了0.22元/小时的价格购买了微软A0类型的云服务器
768M内存、127G硬盘、5M独显带宽


下面开始安装Apache2.4.9服务。
在安装之前,检查了一下gcc,无语啊,是最小配置安装,没有任何软件,系统占用了1.9G。
没gcc,我直接yum安装了gcc
[testuser@localhost ~]sudo su root
[root@localhost ~]yum install gcc
[root@localhost ~]# yum -y install gcc-c++


gcc安装完成了,接下来就知道了没有任何软件安装,也就是 要自己去安装Apr和apr-util了
apr官网下载地址
http://apr.apache.org/
Apr-util官方下载地址
http://apr.apache.org/


我将文件直接wget到我的软件目录/opt/soft/
[testuser@localhost soft]sudo wget http://apache.fayea.com/apache-mirror//apr/apr-1.5.0.tar.gz

[testuser@localhost soft]sudo wget http://apache.fayea.com/apache-mirror//apr/apr-util-1.5.3.tar.gz
 
[testuser@localhost soft]sudo wget http://mirror.esocc.com/apache//httpd/httpd-2.4.9.tar.gz
 
[testuser@localhost soft]sudo wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz


解压apr-1.5.0.tar.gz
tar -xzvf apr-1.5.0.tar.gz
cd apr-util-1.5.3
./configure--prefix=/usr/local/apr
make
make test
make install


解压apr-util.1.5.3.tar.gz
tar -xzvf apr-util-1.5.3.tar.gz
cd apr-util-1.5.3
./configure--prefix=/usr/local/apr-util
make
make test
make install


解压pcre-8.35.tar.gz
tar -xzvf pcre-8.35.tar.gz
cd pcre-8.35
./configure --prefix=/usr/local/pcre
make
make test
make install


解压httpd-2.4.9.tar.gz
tar -xzvf httpd-2.4.9.tar.gz
cd httpd-2.4.9
./configure --prefix=/opt/ansitech/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/
make
make test
make install


解压tomcat-connectors-1.2.39-src.tar.gz
[root@localhost sudytech]# tar -xzvf tomcat-connectors-1.2.39-src.tar.gz
[root@localhost sudytech]# cd tomcat-connectors-1.2.39-src/native
[root@localhost native]# ./configure  --prefix=/usr/local/tomcat-connector  --with-apxs=/opt/ansitech/apache2/bin/apxs
[root@localhost native]# make
[root@localhost native]# make install
在/opt/ansitech/apache2/modules/ 下会产生mod_jk.so


配置httpd.conf
内容如下
-----------------------------------------------------------
# 加载 mod_jk 模块
LoadModule jk_module modules/mod_jk.so
Include  conf/mod_jk.conf
-----------------------------------------------------------
 

创建mod_jk.conf
内容如下
-------------------------------------------------------
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions  +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
 
JKMount /*.jsp worker1
-------------------------------------------------------


接下来我们在 Apache 的 conf 目录下新建两个文件分别是 workers.properties、uriworkermap.properties(可省略)
内容如下
-----------------------------------------------------------
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=127.0.0.1
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300
-----------------------------------------------------------


启动apache、启动tomcat,访问,成功!
It's Works~!