2)安装apache
tar -zxvf httpd-2.2.16.tar.gz
程序解压后得到名为:httpd-2.2.16的文件夹。继续运行以下命令:
cd httpd-2.2.16
./configure --prefix=/usr/local/apache --enable-modules=so --enable-mods-shared-all --enable-proxy --enable-proxy-connect --enable-proxy-ftp --enable-proxy-http --enable-proxy-ajp --enable-proxy-balancer
make
make install
3)配置apache文件
修改apache的配置文件httpd.conf
vi /usr/local/apache/conf/httpd.conf命令进行编辑。
DirectoryIndex index.html index.jsp
找到#Include conf/extra/httpd-vhosts.conf,将前面的注释符#去掉。
在文件的最后添加以下内容并保存:
ProxyRequests Off
SetHandler server-status
Order deny,allow
# Deny from all
Allow from all
#
# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#
ExtendedStatus On
#
# Allow remote server configuration reports, with the URL of
# http://servername/server-info (requires that mod_info.c be loaded).
# Change the ".example.com" to match your domain to enable.
#
SetHandler server-info
Order deny,allow
# Deny from all
Allow from all
SetHandler balancer-manager
Order deny,allow
# Deny from all
Allow from all
(2)配置Tomcat
先在/usr/local目录中建一个名为tomcat的文件夹,然后在终端中运行:
tar -zxvf apache-tomcat-6.0.20.tar.gz
程序解压后得到名为:apache-tomcat-6.0.20的文件夹,将它复制四份到/usr/local/tomcat目录并重命名为tomcat6-1、tomcat6-2、tomcat6-3、tomcat6-4、
进入tomcat6-1目录,修改conf目录下的server.xml文件(以下两个项目不变)
(3)启动服务
先启动各tomcat:
/usr/local/tomcat/tomcat6-1/catalina.sh run
/usr/local/tomcat/tomcat6-2/catalina.sh run
/usr/local/tomcat/tomcat6-3/catalina.sh run
/usr/local/tomcat/tomcat6-4/catalina.sh run
再启动apache:
/usr/local/apache/bin/httpd -k start
重启apache