安装所需文件:
jdk-1_5_0_06-linux-i586.rpm
http-2.2.0.tar.gz
apache-tomcat-5.5.16.tar.gz
jakarta-tomcat-connectors-jk-1.2.6.tar.gz
将安装软件都放在一个目录下,我暂且放在/usr/local下
(1)JDK的安装
[root@longbank]cd /usr/local
[root@longbank]rpm ivh jdk-1_5_0_06-linux-i586.rpm
[root@longbank]vi /etc/profile
配置JDK 进入界面后按 i
JAVA_HOME=/usr/java/jdk1.5.0_06
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/tools.jar;$JAVA_HOEM/lib/dt.jar
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC CLASSPATH JAVA_HOME
然后按Esc,接着同时按下shift与:,输入wq保存退出
(1) apache的安装:
[root@longbank] cd /usr/local
[root@longbank] tar zxvf http-2.2.0.tar.gz
[root@longbank] cd httpd-2.2.0
[root@longbank] ./configure –prefix=/usr/local/apache –with-mpm=worker –enable-mods-shared=all
–enable-proxy –enable-proxy-http –enable-proxy-ajp –enable-proxy-balancer
–enable-proxy-ftp –enable-proxy-connect
–enable-so –enable-modules=so
[root@longbank] make
[root@longbank] make install
[root@longbank]vi /etc/profile
配置tomcat 进入界面后按 i
TOMCAT_HOME=/usr/local/apache-tomcat-5.5.16
在export 中加入TOMCAT_HOME
然后按Esc,接着同时按下shift与:,输入wq保存退出
(2)tomcat的安装:
[root@longbank] cd /usr/local
[root@longbank] tar zxvf apache-tomcat-5.5.16.tar.gz
[root@longbank]
(3) Connectors的安装:
[root@longbank] tar zxvf jakarta-tomcat-connectors-jk-1.2.6.tar.gz
[root@longbank] cd jakarta-tomcat-connectors-jk-src/jk/native
[root@longbank] ./buildconf.sh
[root@longbank] ./configure –with-apxs=/usr/local/apache/bin/apxs
[root@longbank] make
[root@longbank] make install
[root@longbank] vi /usr/local/apache/conf/httpd.conf
listen 80 改为:listen 192.168.10.83:80
注释掉:DocumentRoot /usr/local/apache/htdocs
注释掉:serverAdmin
注释掉:serverName
在文件末尾添加如下内容:
#add mod_jk module
LoadModule jk_module modules/mod_jk.so
# Update this path to match your modules location
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile /usr/local/apache/conf/workers.properties
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile /usr/local/apache/conf/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat “[%a %b %d %H:%M:%S %Y] “
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat “%w %V %T”
# Send everything for context /examples to worker named worker1 (ajp13)
JkMount /*.jsp worker1
JkMount /server/* worker1
新建此文件/usr/localapache/conf/workers.properties 添加如下内容:
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.reclycle_timeout=300
.指定虚拟主机配置文件
440 #Virtual hosts
441 #Include conf/extra/httpd-vhosts.conf
将441行的注释去掉,就可以拉。
4.进入/conf/extra
[root @ longbank] #vi httpd-vhosts dot conf
NameVirtualHost 192.168.10.83:80
<VirtualHost 124.42.108.146:80>
ServerName news.longbank.com.cn
<Directory “/usr/fw104/apache-tomcat-5.5.16/webapps/WebModule1”>
DirectoryIndex index.htm index.jsp index.html
</Directory>
DocumentRoot /usr/fw104/apache-tomcat-5.5.16/webapps/WebModule1
<IfModule mod_proxy.c>
ProxyPass /WebModule1/ http://news.longbank.com.cn:82/
ProxyPassReverse /WebModule1/ http://news.longbank.com.cn:82/
</IfModule>
</VirtualHost>
<VirtualHost 124.42.108.146:80>
ServerName www.longbank.com.cn
<Directory “/usr/fw104/apache-tomcat-5.5.16/webapps/WebModule1”>
DirectoryIndex index.htm index.jsp index.html
</Directory>
DocumentRoot /usr/fw104/apache-tomcat-5.5.16/webapps/WebModule1
<IfModule mod_proxy.c>
ProxyPass /WebModule1/ http://www.longbank.com.cn:82/
ProxyPassReverse /WebModule1/ http://www.longbank.com.cn:82/
</IfModule>
</VirtualHost>
接着配置tomcat
[root@longbank] vi /usr/local/apache-tomcat-5.5.16/conf/server.xml
将80改为82
接着加入
<Host name=”news.longbank.com.cn” appBase=”webapps” unpackWARs=”true” autoDeploy=”true”
xmlValidation=”false” xmlNamespaceAware=”false”>
<Context path=”” docBase=”/usr/fw104/apache-tomcat-5.5.16/webapps/WebModule1″ debug=”1″>
</Context>
</Host>
<Host name=”www.longbank.com.cn” appBase=”webapps”
unpackWARs=”true” autoDeploy=”true”
xmlValidation=”false” xmlNamespaceAware=”false”>
<Context path=”” docBase=”/usr/fw104/apache-tomcat-5.5.16/webapps/WebModule1″ debug=”1″>
</Context>
</Host>
OK.大公告成,然后只需要在购买域名的网站将IP指到这台机器的交换机,然后交换机指到这台82的机器就好使了
我们一直都在努力坚持原创.......请不要一声不吭,就悄悄拿走。
我原创,你原创,我们的内容世界才会更加精彩!
【所有原创内容版权均属TechTarget,欢迎大家转发分享。但未经授权,严禁任何媒体(平面媒体、网络媒体、自媒体等)以及微信公众号复制、转载、摘编或以其他方式进行使用。】
微信公众号
TechTarget
官方微博
TechTarget中国