fedora5下apache tomcat 安装和整和
时间:2006-09-23 来源:ldd600
安装j2sdk-1_4_2_02-linux-i586-rpm.bin(或其他版本都ok)
下载后双击安装
______________________________________________________ 配置环境变量
编辑/etc/profile 加入下面句:
PATH=/usr/j2se/bin (改为你安装j2sdk的路径)
JAVA_HOME=/usr/j2se (改为你安装j2sdk的路径)
CLASSPATH=/usr/j2se/lib/tools.jar:/usr/j2se/lib/dt.jar (改为你安装j2sdk的路径)
export PATH JAVA_HOME CLASSPATH 重新启动使之生效
_________________________________________________________________
Tomcat 5.0.25 在http://www.apache.org下载得到jak...-5.0.25.tar.gz
#gunzip jakarta-tomcat-5.0.25.tar.gz
#tar xvf jakarta-tomcat-5.0.25.tar
#mv jakarta-tomcat-5.0.25 /usr/local/tomcat5.0.25
#cd /usr/local/tomcat5.0.25/bin
#./catalina.sh start 然后测试 http://localhost:8080 看到那个猫了吧,恭喜你tomcat安装ok _____________________________________________________________________ 安装apache2.0.50
估计用到的工具有:gcc,automake,autoconfig;libtools,m4 大家可以去下载rpm包安装就行了,别忘了写人环境变量噢 :-P 到http://www.apache.org下载后 gunzip httpd-2.0.50.tar.gz
tar xvf httpd-2.0.50.tar
cd httpd-2.0.50/bin
./configure -prefix=/usr/local/apache2 -enable-so (可改为你自己的目录;-enable-so用于加载connector,不可省略,你还可以加上你自己的其他模块)
make
make install
cd /usr/local/apache2/conf
vi httpd.conf
更改:servername 你的机器ip或域名
group nobody
listen yourip:80 (apache2以后把port已经改成了listen) 保存后,cd ../bin
./apachectl start 测试:http://localhost 看到apache的欢迎界面了吧,ok _____________________________________________________________________________________ 整合apache2与tomcat5.0.25 用连接器jakarta-tomcat-connectors-jk2-src-current.tar.gz(就是jk2),大家可到http://jakarta.apache.org/site/sourceindex.cgi下载 gunzip jakarta-tomcat-connectors-jk2-src-current.tar.gz
tar xvf jakarta-tomcat-connectors-jk2-src-current.tar
cd jakarta-tomcat-connectors-jk2-src-current/jk/native2
./configure --with-apxs2=/usr/local/apache2/bin/apxs (注意改为你的apache安装目录)
make
cd ../build/jk2/apache2
/usr/local/apache2/bin/apxs -n jk2 -i mod_jk2.so
现在大家可以看到mod_jk2.so文件已经在你的apache/modules/ 中了 编辑apache/conf/httpd.conf
LoadModule jk2_module modules/mod_jk2.so 保存 在apache/conf/中新建文件workers2.properties,内容为下(注意其中目录要改为你的目录噢): [shm]
file=/usr/local/apache2/logs/shm.file
size=1048576
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# Uri mapping
[uri:/*]
worker=ajp13:localhost:8009 保存后,就快大功告成啦,呵呵 cd apache2/bin
./apachectl start 测试:http://localhost 大家是不是看到了那个猫猫的界面啊,恭喜恭喜,整合成功咯!!!(可别忘了启动tomcat)
-----------------------------------------------------------------------------------------------------------------------
改tomcat下的wever.xml
加入如下一段 并去掉原先的<HOST>那段
可以参考备份的server.xml <Host name="211.67.20.178" debug="0" appBase="/mnt/d/web" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="" debug="0" reloadable="true"/>
<Context path="/test" docBase="test" debug="0" reloadable="true"/>
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="home_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
</Host>
<Host name="bbs.ourroad.com" debug="0" appBase="/mnt/d/web/bbs" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="" debug="0"/>
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="home_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
</Host>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="" debug="0" reloadable="true"/>
<Context path="/test" docBase="test" debug="0" reloadable="true"/> 这样做了以后可以改变烦人的小老虎的主页,打开后就不会显示小老虎了。比如http://211.67.20.17,但是不能正确显示index.jsp。还跟下下一步有关
------------------------------------------------------------------------------------------------------------------------------
在apache2的最后加上
#NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot "/mnt/d/web/phpMyAdmin"
<Directory "/mnt/d/web/PhpMyAdmin">
Options ExecCGI
Order allow,deny
Allow from All
</Directory>
DirectoryIndex index.php index.asp index.htm index.html
</VirtualHost>
<VirtualHost 211.67.20.178>
DocumentRoot "/mnt/d/web/"
ServerName 211.67.20.178
<Directory "d:/web/">
Options ExecCGI
Order allow,deny
Allow from All
</Directory>
DirectoryIndex index.jsp index.php index.php3 index.htm index.html
</VirtualHost> -------------------------------------------------------
一定要修改tomcat5.5.16/webapps/root/WEB-INF/web.xml
<servlet-mapping>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<url-pattern>/index.jsp</url-pattern>
</servlet-mapping>
改成 <servlet-mapping>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping> 这样才能使得你网站根目录下的 index.jsp被正确打开 即http://211.67.20.17/可以正确显示结果 而不用输入http://211.67.20.17/index.jsp了 。 ----------------------------------------------------------------------------------------
apache启动方法: bin下的 ./apachectl start
./apachectl stop tomcat启动方法 :bin下的 ./shutdown.sh ./startup.sh
manager: http://localhost:8080/manager/html/
admin: http://localhost:8080/admin -------------------------------------- apache 整合 tomcat支持servlet
首先建WEB-INF目录其下面和tomcat相同
接着修改apahe下面的workers2.properties加上
[uri:***.***.***.***/*.do]
worker=ajp13:localhost:8009
那么web.xml要把定制的url-pattern的名称加上do后缀
在servlet运行时只要输入 *****.do
下载后双击安装
______________________________________________________ 配置环境变量
编辑/etc/profile 加入下面句:
PATH=/usr/j2se/bin (改为你安装j2sdk的路径)
JAVA_HOME=/usr/j2se (改为你安装j2sdk的路径)
CLASSPATH=/usr/j2se/lib/tools.jar:/usr/j2se/lib/dt.jar (改为你安装j2sdk的路径)
export PATH JAVA_HOME CLASSPATH 重新启动使之生效
_________________________________________________________________
Tomcat 5.0.25 在http://www.apache.org下载得到jak...-5.0.25.tar.gz
#gunzip jakarta-tomcat-5.0.25.tar.gz
#tar xvf jakarta-tomcat-5.0.25.tar
#mv jakarta-tomcat-5.0.25 /usr/local/tomcat5.0.25
#cd /usr/local/tomcat5.0.25/bin
#./catalina.sh start 然后测试 http://localhost:8080 看到那个猫了吧,恭喜你tomcat安装ok _____________________________________________________________________ 安装apache2.0.50
估计用到的工具有:gcc,automake,autoconfig;libtools,m4 大家可以去下载rpm包安装就行了,别忘了写人环境变量噢 :-P 到http://www.apache.org下载后 gunzip httpd-2.0.50.tar.gz
tar xvf httpd-2.0.50.tar
cd httpd-2.0.50/bin
./configure -prefix=/usr/local/apache2 -enable-so (可改为你自己的目录;-enable-so用于加载connector,不可省略,你还可以加上你自己的其他模块)
make
make install
cd /usr/local/apache2/conf
vi httpd.conf
更改:servername 你的机器ip或域名
group nobody
listen yourip:80 (apache2以后把port已经改成了listen) 保存后,cd ../bin
./apachectl start 测试:http://localhost 看到apache的欢迎界面了吧,ok _____________________________________________________________________________________ 整合apache2与tomcat5.0.25 用连接器jakarta-tomcat-connectors-jk2-src-current.tar.gz(就是jk2),大家可到http://jakarta.apache.org/site/sourceindex.cgi下载 gunzip jakarta-tomcat-connectors-jk2-src-current.tar.gz
tar xvf jakarta-tomcat-connectors-jk2-src-current.tar
cd jakarta-tomcat-connectors-jk2-src-current/jk/native2
./configure --with-apxs2=/usr/local/apache2/bin/apxs (注意改为你的apache安装目录)
make
cd ../build/jk2/apache2
/usr/local/apache2/bin/apxs -n jk2 -i mod_jk2.so
现在大家可以看到mod_jk2.so文件已经在你的apache/modules/ 中了 编辑apache/conf/httpd.conf
LoadModule jk2_module modules/mod_jk2.so 保存 在apache/conf/中新建文件workers2.properties,内容为下(注意其中目录要改为你的目录噢): [shm]
file=/usr/local/apache2/logs/shm.file
size=1048576
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# Uri mapping
[uri:/*]
worker=ajp13:localhost:8009 保存后,就快大功告成啦,呵呵 cd apache2/bin
./apachectl start 测试:http://localhost 大家是不是看到了那个猫猫的界面啊,恭喜恭喜,整合成功咯!!!(可别忘了启动tomcat)
-----------------------------------------------------------------------------------------------------------------------
改tomcat下的wever.xml
加入如下一段 并去掉原先的<HOST>那段
可以参考备份的server.xml <Host name="211.67.20.178" debug="0" appBase="/mnt/d/web" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="" debug="0" reloadable="true"/>
<Context path="/test" docBase="test" debug="0" reloadable="true"/>
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="home_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
</Host>
<Host name="bbs.ourroad.com" debug="0" appBase="/mnt/d/web/bbs" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="" debug="0"/>
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="home_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
</Host>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="" debug="0" reloadable="true"/>
<Context path="/test" docBase="test" debug="0" reloadable="true"/> 这样做了以后可以改变烦人的小老虎的主页,打开后就不会显示小老虎了。比如http://211.67.20.17,但是不能正确显示index.jsp。还跟下下一步有关
------------------------------------------------------------------------------------------------------------------------------
在apache2的最后加上
#NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot "/mnt/d/web/phpMyAdmin"
<Directory "/mnt/d/web/PhpMyAdmin">
Options ExecCGI
Order allow,deny
Allow from All
</Directory>
DirectoryIndex index.php index.asp index.htm index.html
</VirtualHost>
<VirtualHost 211.67.20.178>
DocumentRoot "/mnt/d/web/"
ServerName 211.67.20.178
<Directory "d:/web/">
Options ExecCGI
Order allow,deny
Allow from All
</Directory>
DirectoryIndex index.jsp index.php index.php3 index.htm index.html
</VirtualHost> -------------------------------------------------------
一定要修改tomcat5.5.16/webapps/root/WEB-INF/web.xml
<servlet-mapping>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<url-pattern>/index.jsp</url-pattern>
</servlet-mapping>
改成 <servlet-mapping>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping> 这样才能使得你网站根目录下的 index.jsp被正确打开 即http://211.67.20.17/可以正确显示结果 而不用输入http://211.67.20.17/index.jsp了 。 ----------------------------------------------------------------------------------------
apache启动方法: bin下的 ./apachectl start
./apachectl stop tomcat启动方法 :bin下的 ./shutdown.sh ./startup.sh
manager: http://localhost:8080/manager/html/
admin: http://localhost:8080/admin -------------------------------------- apache 整合 tomcat支持servlet
首先建WEB-INF目录其下面和tomcat相同
接着修改apahe下面的workers2.properties加上
[uri:***.***.***.***/*.do]
worker=ajp13:localhost:8009
那么web.xml要把定制的url-pattern的名称加上do后缀
在servlet运行时只要输入 *****.do
相关阅读 更多 +