虽然tomcat也可以作web服务器,但其处理静态html的速度比不上apache,且其作为web服务器的功能远不如apache,因此把apache和tomcat集成起来。以linux系统为例介绍.从apache网站下载apache1.3.23源代码版本,然后使用如下命令配置安装apache:
mkdir /usr/local/apache
tar zxvf apache.1.33.tar.gz
cd apache.1.33
./configure --prefix=/usr/local/apache --enable-module=so
make
make install注意configure命令指定目标安装目录,并且加入DSO(Dynamic Shared Object)支持,注意一定不要忘了这一个选项。然后下载webapp模块,将解压后mod_webapp.so文件放入apache的libexec目录,编辑apache的conf目录下的httpd.conf,在这个文件的最后加入下面三行:
LoadModule webapp_module libexec/mod_webapp.so
WebAppConnection warpConnection warp localhost:8008
WebAppDeploy examples warpConnection /examples/
第一行是加入webapp模块,如果编译apache时不增加DSO支持,则无法使用LoadModule指令,第二行指定tomcat与apache的连接,第三行指定部署那个应用,这两个指令使用格式如下:
WebAppConnection [connection name] [provider] [host:port]
WebAppDeploy [application name] [connection name] [url path] 其中connection name指定连接名,provider只能是warp,port端口与你的tomcat的配置文件server.xml最后几行指定的要保持一致。文件如下:
<Service name="Tomcat-Apache">
<Connector className="org.apache.catalina.connector.warp.WarpConnector"
port="8008" minProcessors="5" maxProcessors="75"
enableLookups="true"
acceptCount="10" debug="0"/>
******
</Service> application name与你在tomcat中部署的应用名一致,url path指定访问这个应用的url。例如上面的例子可以通过http://localhost/examples/来访问tomcat中的examples应用。
mkdir /usr/local/apache
tar zxvf apache.1.33.tar.gz
cd apache.1.33
./configure --prefix=/usr/local/apache --enable-module=so
make
make install注意configure命令指定目标安装目录,并且加入DSO(Dynamic Shared Object)支持,注意一定不要忘了这一个选项。然后下载webapp模块,将解压后mod_webapp.so文件放入apache的libexec目录,编辑apache的conf目录下的httpd.conf,在这个文件的最后加入下面三行:
LoadModule webapp_module libexec/mod_webapp.so
WebAppConnection warpConnection warp localhost:8008
WebAppDeploy examples warpConnection /examples/
第一行是加入webapp模块,如果编译apache时不增加DSO支持,则无法使用LoadModule指令,第二行指定tomcat与apache的连接,第三行指定部署那个应用,这两个指令使用格式如下:
WebAppConnection [connection name] [provider] [host:port]
WebAppDeploy [application name] [connection name] [url path] 其中connection name指定连接名,provider只能是warp,port端口与你的tomcat的配置文件server.xml最后几行指定的要保持一致。文件如下:
<Service name="Tomcat-Apache">
<Connector className="org.apache.catalina.connector.warp.WarpConnector"
port="8008" minProcessors="5" maxProcessors="75"
enableLookups="true"
acceptCount="10" debug="0"/>
******
</Service> application name与你在tomcat中部署的应用名一致,url path指定访问这个应用的url。例如上面的例子可以通过http://localhost/examples/来访问tomcat中的examples应用。
解决方案 »
- 刚看到一个关于java中只有值传递的帖子,关于“值”的问题,是否是个文字游戏?欢迎讨论
- 请问初学JAVA,用什么编辑器比较好啊?
- 100分求<<JFC核心编程>>的源代码.(有那位xdjm买了这本书的话,共享一下源代码给我好吗?)分可以再加
- java 的输入。。。
- 发现applet动画窗口嵌在网页里运行效率比较高,但是嵌在jframe窗口里运行,效率就不行
- 关于queryDataSet1的用法
- abstract关键子有什么作用啊?
- 用java JTable做了一个删除数据库的小程序,想将它拿到其它机器上用,如何不用安装JDK就能运行?请指点,谢谢。
- 为什么我的appletviewer无法显示汉字
- Java中子类构造调用父类构造之前写代码会报错
- 请gutsyu(SL55AMG)看一下主题为"tomcat4.0.3和apache1.3.23是否需要配置一下才能使用"的贴子。
- 求教sleep(1000),着急!着急!着急!
谢谢
Installing mod_webapp and using it with Apache 1.3
--------------------------------------------------Once you have successfully built the mod_webapp DSO as described in the
README.txt file coming with the sources, installing the module is pretty
easy.First of all, copy the resulting mod_webapp.so file you will find in this
directory (or in the apache-1.3 directory if you're building from sources)
into your Apache 1.3 "libexec" directory (that directory where all DSO modules
for Apache reside).If you're using Apache 1.3 for Windows, your modules directory will be called
"modules" (there's a "libexec directory, but it contains other stuff). Please
take care when loading the module. For Windows your "LoadModule" directive
looks like: LoadModule webapp_module modules/mod_webapp.soAnother note for Windows: copy also the "libapr.dll" file with the module, or
your Apache 1.3 web server will refuse to start reporting that the WebApp
module cannot be loaded.Once you have done that, edit your "httpd.conf" configuration file and
add a few lines to load that module at startup (Windows users, read above,
you have to "replace" libexec with "modules" - I'm paranoid, sorry): LoadModule webapp_module libexec/mod_webapp.so
and
AddModule mod_webapp.cNOTE: It was reported that sometimes Apache under windows doesn't like the
AddModule line in the configuration file. Please, if you can't start your
Apache service, try commenting out that line in your httpd.conf file.Looking at the default "httpd.conf" file coming with Apache 1.3, I usually
add the "LoadModule ..." line at the end of all pre-written and commented out
"LoadModule" directives, and my "AddModule ..." directive at the end of all
commented out "AddModule" directives. My "httpd.conf" file looks something
like this: [...]
#LoadModule unique_id_module libexec/mod_unique_id.so
#LoadModule dav_module libexec/libdav.so
#LoadModule ssl_module libexec/libssl.so
LoadModule webapp_module libexec/mod_webapp.so
[...]
ClearModuleList
[...]
#AddModule mod_unique_id.c
#AddModule mod_dav.c
#AddModule mod_ssl.c
AddModule mod_webapp.c
[...]Once you've edited your "httpd.conf" in such fashion, it's better to check
if everything still works within the Apache core. You can test your newly
constructed configuration by issuing: apachectl configtestThe apachectl script comes with your Apache 1.3 distribution. It usually
lies in /usr/local/apache/bin, but depending on _YOUR_ apache distribution,
that might change.Once you verified that "apachectl" reports "Syntax OK" (meaning that all
modules have been successfully loaded and started), you can start adding your
web application connections and context into the Apache configurations.
Back to the "httpd.conf" file, you need to add something like: WebAppConnection conn warp localhost:8008
WebAppDeploy examples conn /examplesIn this example, I'm instructing the WebApp connector to connect to the
servlet container waiting for requests on the current "localhost" host and
bound to port 8008 (note, this port is the one you specified in your
"server.xml" file for the "org.apache.catalina.connectors.warp.WarpConnector"
connector, not your HTTP one).A brief detailed description of the above-mentioned directives is: WebAppConnection [connection name] [provider] [host:port] [connection name]
A unique name for the connection to be created between Apache
and Tomcat. [provider]
The name of the provider used to connect to the servlet container.
Currently only the "warp" provider is available. [host:port]
The host name and port number to which the WARP connection must
attempt to connect. The port is the one you specified in your
"server.xml" file for the "...WarpConnector" connector, not your
HTTP one. WebAppDeploy [application name] [connection name] [url path] [application name]
The application name as present in your "webapps" directory in
Tomcat. For example, if you want to deploy a WAR-based web
application, your application name will look something like
"myApplication.war". [connection name]
The name of a previously declared WebAppConnection directive. [url path]
The URL path where this application will be deployed.The "WebAppDeploy" directive is scoped around the current host, meaning that
if you insert it into a "<VirtualHost ...>" tag, your application will be
deployed only for that particular virtual host. To deploy the same application
on several virtual hosts, you will have to declare it once inside each
"<VirtualHost ...>" tag. This, in accordance with the Servlet specification,
will create a new instance of the web-application per virtual host.Another directive is available for the WebApp connector. The "WebAppInfo"
directive will allow you to see the current status of all configured
connections and deployed applications. To use it, simply add something like: WebAppInfo /webapp-infoYou can then access the information page hitting your web server for the
following URL: http://server.name:port/webapp-info/Have fun...
Cannot load d:/apache group/apache/modules/mod_webapp.so into server: (193)