[关闭]
@Fancy-Bai 2015-08-17T09:17:11.000000Z 字数 1999 阅读 2355

Apache2.4 + Tomcat7负载均衡和集群(一)

Apache,Tomcat


准备安装包

安装步骤

将事先下载好的安装包上传到Linux服务器上

新建一个目录用于存放安装包

  1. # cd /usr/local
  2. # mkdir software

安装apr

  1. # cp /usr/local/software/apr-1.5.2.tar.gz /usr/local
  2. # cd /usr/local
  3. # tar -zxvf apr-1.5.2.tar.gz
  4. # cd apr-1.5.2
  5. # ./configure --prefix=/usr/local/apr
  6. # make && make install

安装apr-util

  1. # cp /usr/local/software/apr-util-1.5.4.tar.gz /usr/local
  2. # cd /usr/local
  3. # tar -zxvf apr-util-1.5.4.tar.gz
  4. # cd apr-util-1.5.4
  5. # ./configure --prefix=/usr/local/apr-util
  6. # make && make install

安装pcre

  1. # cp /usr/local/software/pcre-8.36.tar.gz /usr/local
  2. # cd /usr/local
  3. # tar -zxvf pcre-8.36.tar.gz
  4. # cd pcre-8.36.tar.gz
  5. # ./configure --prefix=/usr/local/pcre
  6. # make && make install

安装httpd

  1. # cp /usr/local/software/httpd-2.4.12.tar.gz /usr/local
  2. # cd /usr/local
  3. # tar -zxvf httpd-2.4.12.tar.gz
  4. # cd httpd-2.4.12.tar.gz
  5. # ./configure --prefix=/usr/local/apache --enable-so -enable-proxy -enable-proxy_http=shared --enable-module=so --enable-mods-shared=all --enable-proxy-ajp=shared --enable-proxy-balancer -with-mpm=worker --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre
  6. # make && make install

安装jk

  1. # cp /usr/local/software/tomcat-connectors-1.2.40-src.tar.gz /usr/local
  2. # cd /usr/local
  3. # tar -zxvf tomcat-connectors-1.2.40-src.tar.gz
  4. # cd tomcat-connectors-1.2.40-src
  5. # chmod 755 buildconf.sh
  6. # ./buildconf.sh
  7. # ./configure --with-apxs=/usr/local/apache/bin/apxs
  8. # make && make install
  9. # cp ./apache-2.0/mod_jk.so /usr/local/apache/modules/

Apache配置及测试

修改apache的配置文件:

  1. # vi /usr/local/apache/conf/httpd.conf

1.查找ServerName,修改:

  1. ServerName 162.16.1.229:8000 # 对应Linux服务器的IP

2.查找Listen,修改为:

  1. Listen 8000

3.查找以下内容,并在index.html后面添加index.jsp

  1. <IfModule dir_module>
  2. <DirectoryIndex index.html index.jsp
  3. </IfModule>

4.查找以下内容,并去掉前面的注释

  1. #Include conf/extra/httpd-mpm.conf
  2. #Include conf/extra/httpd-default.conf
  3. #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so

5.测试

启动Apache:# /url/local/apache/bin/apachectl start
打开浏览器,输入:http://162.16.1.229:8000 (根据个人机器IP不同),如果页面出现It's Workds!说明Apache安装成功。


Apache2.4 + Tomcat7负载均衡和集群(二)

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注