今天以了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
4.配置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~!