apache-2.0.43和tomcat-4.1.12集成

电池管理系统(BMS)系列—状态估计之SOH BMS系列文章,介绍了SOH估计 阅读详情

Apache 2.0.48 / Tomcat 4.1.29 / mod_jk for Windows XP Pro


last update: 12/13/2003

Building an Apache HTTP + Tomcat environment is five major steps:

  1. install JDK
  2. install Apache
  3. install Tomcat
  4. install a connector, in this case JK
  5. configure and test

Since Tomcat is 100% Java, we'll use the binary install instead of having to deal with ant. My preference is to put things in locations on disk so that spaces are not part of the path name. Use whichever location suits your purposes, but there have been many posts on various mailing lists where path names with spaces caused mysterious, hard to diagnose problems. It's best to avoid them when possible. Aside from that, paths in this scenario don't have much effect as long as you can guarantee that they are consistent throughout the various configuration steps.

Assumptions

  1. Directory names, folder names, and any path names WILL NOT have spaces in them. Whenever possible, store things in places where the path names do not have spaces.
  2. Mod_jk is used as the Apache connector.
  3. You don't want multiple virtual hosts. If you want to have multiple virtual hosts, that is, more/other than http://localhost, check out my Virtual Hosting HOWTO. (coming soon)
  4. You want Tomcat and Apache installed as services, not as user-level applications.
  5. Your user account has administrator privileges. If it doesn't, find someone who does.

Install JDK

  1. go to Sun's Java download site and download J2SE for Windows: http://java.sun.com/j2se/1.4.2/download.html. I prefer the SDK version, and I prefer the Offline Installation version. Offline because then you can copy it to a shared folder or even burn it to a CD, and install it as many times as you like without needing an Interne connection. From here on out, I will assume that you've got the SDK version, and are using the Offline Installation version. When you finish downloading, you will have a file called j2sdk-1_4_2_01-windows-i586.exe.
  2. To install J2SDK, just execute the file you downloaded. Once the Installer is finished unpacking, you'll be presented with a standard license prompt. (screenshot) If you agree, choose the appropriate option and click Next.
  3. The installer will display a standard installation dialog. (screenshot) Click Next. This will install J2SE in C:/j2sdk1.4.2_01, which is fine.
  4. Register the browsers on your system, and click Install. (screenshot)
  5. After the install has finished, click Finish.

Build/Install Apache HTTP

  1. First and foremost, make sure you do not have a web server or other process already listening on port 80. Click Start->Administrative Tools->Services and scroll the right hand window pane until you can see the service named World Wide Web Publishing. Highlight that service, and click the Stop icon in the toolbar. (screenshot)
  2. While you have the Services applet open, choose the World Wide Web Publishing service again, and click on the Properties icon in the toolbar. In the next window, choose Manual where it says Startup type. Click OK, then close the Services applet. (screenshot)
  3. Download the Windows MSI Apache distribution from a mirror. You want version 2.0.48. The filename is apache_2.0.48-win32-x86-no_ssl.msi.
  4. Execute the MSI installer. You'll see a welcome screen. (screenshot)
  5. Click Next. Accept the terms of the license, and click Next again. The README file will be displayed. Read through it, and when finished, click Next.
  6. On the next screen, replace the default values with localhost for Network Domain and Server Name. For Email Address, use your email address or any other value you wish. Make sure to choose the option For All Users, on Port 80 as well. Click Next when ready. (screenshot)
  7. On the next screen, choose Typical and click Next.
  8. We are going to put Apache 2.0.48 in a directory called C:/ApacheGroup. Notice the lack of spaces in the path name. To do this, click the button that says Change and use the file dialog box to change to the C:/ drive, where you will create a new folder called ApacheGroup. When finished, your screen should look like this. If it does, click Next to continue to the next screen.
  9. You should be looking at the final screen before the install process begins. (screenshot) Click Install to begin the installation.
  10. When the installation is finished, a screen will be displayed. Click the Finish button. You should now have an Apache instance in C:/ApacheGroup/Apache2. Verify the installation by opening a web browser and browsing to http://localhost. If everything installed correctly, you will see an Apache Welcome page.
  11. Shutdown Apache until you can get the connector installed by right-clicking on the Apache monitor service in your taskbar (it's the tiny feather icon), and selecting Stop. (screenshot)

Build/Install Tomcat

  1. First, create a folder on your hard drive. Call it Tomcat, and put it in the C drive root, so that you end up with C:/Tomcat. NOTE: You can put Tomcat wherever you like, it is your choice. Wherever you put it, try to keep spaces or other unusual characters out of the pathname.
  2. Now, grab the Windows EXE distribution for Tomcat 4.1.29 from a mirror site. The filename is jakarta-tomcat-4.1.29.exe
  3. Once it is downloaded, execute the file.
  4. Agree to the license, and click Next. On the next screen, check the box marked NT Service. (screenshot) Click Next again.
  5. Next, change the directory where Tomcat will be installed. Change the default so that there are no spaces in the pathname. (screenshot)
  6. When the install completes, you'll be presented with a final screen that will let you test your installation. (screenshot) Make sure to use a decent password for the admin user. Click Next to verify and complete the installation.
  7. At this point, Tomcat should be running. Browse to http://localhost:8080 to be sure. If everything is ready, you'll see the Tomcat Welcome page. Verify the Tomcat examples are available at http://localhost:8080/examples.

Install the Connector

The two connectors (JK and JK2) are different; JK2 is a complete rewrite of the earlier JK/AJP13 protocol. We'll cover installing JK here. For JK2, check out my JK2 HOWTO (coming soon).
  1. Download the connector binary for Windows from a Jakarta mirror site. Scroll down to where it says Tomcat Web Server Connectors and then click on JK 1.2 Binary Releases. Click on the Win32 folder and download the file named mod_jk_1.2.5_2.0.47.dll.
  2. When the download is complete, copy the DLL file to C:/ApacheGroup/Apache2/modules. Rename the file to mod_jk.dll. This will leave you with C:/ApacheGroup/Apache2/modules/mod_jk.dll. The location on your system may be different...that's fine, the point is to put the JK DLL file in Apache's modules directory, wherever that may be.

Final Configuration

NOTE: these steps will allow access to the Tomcat examples via Apache on port 80. Successful use of the examples on port 80 shows that mod_jk is working correctly, since Tomcat is configured to run on port 8080 by default for HTTP requests.
  1. You're going to be making edits to a file called server.xml in Tomcat's conf directory. If you've used the installation locations suggested previously, the file you want is C:/Tomcat/Tomcat-4.1/conf/server.xml. This file is vital to Tomcat operation, so it is a good idea to make a copy before it gets modified.
  2. Now, let's edit server.xml in Tomcat's conf. Use any editor you'd like. For our purposes, we'll use Notepad.
  3. Look for a line that says "Server" and has a port of 8005. Add the following directly below:
    <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" modJk="C:/ApacheGroup/Apache2/modules/mod_jk.dll" />
  4. In the Host container add the following Listener directive (yes, it looks very similar to the one above):
    <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" append="true" forwardAll="false" modJk="C:/ApacheGroup/Apache2/modules/mod_jk.dll" />
    Save your changes and exit the editor.
  5. Now, we need to make a small edit to Apache's httpd.conf. Edit httpd.conf in APACHE_HOME/conf. Don't worry about making a copy, the Apache team put one there for you already (it's called httpd-std.conf). Like editing server.xml, use any editor you'd like.
  6. Add a single line at the end of the file:
    Include "C:/Tomcat/Tomcat-4.1/conf/auto/mod_jk.conf"
    Note: the mod_jk.conf file gets created by Tomcat when Tomcat starts. It gets created every time Tomcat starts. So, if you have your server.xml configured, you can ignore httpd.conf (in most cases) except to add the Include directive for mod_jk.conf. You don't need to create or edit mod_jk.conf, Tomcat will do this for you. Click here for a sample mod_jk.conf file generated automatically by Tomcat on each startup.
  7. Create a file in C:/Tomcat/Tomcat-4.1/conf/jk called workers.properties. In that file, put the following lines:
    worker.list=ajp13
    worker.ajp13.port=8009
    worker.ajp13.host=localhost
    worker.ajp13.type=ajp13
    Save the file. This file provides necessary information to mod_jk, like where to find Tomcat and what port to use when connecting.
  8. Start Tomcat: Wait at least 30 seconds for tomcat to complete the startup process. Verify that you have a file called C:/Tomcat/Tomcat-4.1/conf/auto/mod_jk.conf and that the timestamp on that file is recent before going to the next step. An example mod_jk.conf file can be found here.
  9. Start Apache.
  10. Verify examples at http://localhost:8080/examples. On success, Tomcat is working correctly.
  11. Verify examples at http://localhost/examples. On success, Apache is working correctly, and JSP and servlet requests are being passed to Tomcat.

Please send comments, suggestions, or changes to john AT johnturner DOT com. Be advised that I will be happy to help where I can, but I am not available for free one-on-one tech support to the whole world. :)

Other Resources

My Apache + Tomcat Virtual Hosting HOWTO (coming soon)
My Apache + Tomcat + JK2 HOWTO (coming soon)
Oscar Carillo's Tomcat Site
The Tomcat FAQ

配置整合Win+Apache+PHP+MySQL+Tcomcat(或Resin)完全手册
作者:未知 来源:未知 加入时间:2004-8-24 天新软件园
系统要求:
          硬件能跑起操作系统即可
          Win2K、WinXP或 Win2003操作系统
          
前期准备:
          所需软件列表:(本配置以 下列软件版本完成)
1、 APACHE_2.0.47-win32-x86-no_ssl  (Apache web服务器)
2、 PHP-4.3.3-Win32                  (PHP语言解析器)
3、 MySQL-4.0.12-win                 (MySQL数据库)
4、 j2sdk-1_4_2-windows-i586          (JAVA 语言环境)
5、 Jakarta-Tomcat-5.0.9              (Tomcat JSP解析服务器)
6、 Resin-3.0.3                       (Resin JSP解析服务器)
7、 mod_jk_1.2.5_2.0.47.dll            (整合Apache+Tomcat的plus)
8、 mm.mysql-2.0.4-bin.jar             (JSP访问连接MySQL文件)

开始安装:
   
一、 Apahce+PHP+MySQL安装配置

1. 安装APACHE_2.0.47-win32-x86-no_ssl ,程序默认安装路径为:C:/apache2/program files/apache Group/ ,需要将其安装路径修改为:C:/
(也可以不做修改,主要为了修改配置方便做修改的)。
2. 安装完成之后,apache服务自动加载,这时打开浏览器,浏览:http://localhost,出现apache欢迎页面(这步需要将C:/ apache2/htdocs目录中的文件“index.html.en”改为“ index.html”,方能显示);如果这步出现异常,请检查安装源文 件,重新安装。
3. 安装PHP-4.3.3-Win32,一般下载的PHP文件为一个免安装的压缩包,解压到C:/PHP就可以。
4. 配置PHP和Apache,使之能解析php程序。
PHP配置:将C:/PHP/目录中的“php.ini-dist”改名“php.ini”,并复制到 C:/windows/system32(Win2K目录为:C:/winnt/system32)
Apache配置:
C:/apahce2/conf/httpd.conf




httpd.conf
D在此配置文件最后添加以下语句,用以支持php程序:
    ScriptAlias /php/ "C:/PHP/"
    AddType application/x-httpd-php .php3
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .phtml
    Action application/x-httpd-php "/php/php.exe"

         5.重新启动Apache服务器,用编 辑器编写如下语句:             
<?
  phpinfo();
?>

             保存文件名为“test.php”到C:/apache2/htdocs目录,然后打开浏览器,浏览:http: //localhost/test.php,出现PHP基本信息就说明配置成功。严格按以上说明安装配置,都会一次成功。
         6. 安装MySQL-4.0.12-win,一直按”next”就安装成功了,然后在C:/mysql/bin目录执行 ” winmysqladmin.exe”,出现mysql的初始信息面,表示安装成功。
         7. PHP连MySQL此处略过,一般没有什么问题。
         
到此可以休息一下,准备下面的漫长过程……

二、安装JDK和Tomcat
1. 安装j2sdk-1_4_2-windows-i586,JDK一定要在Tomcat和Resin之前安装,默认安装路径就可以。
2. 安装Jakarta-Tomcat-5.0.9,默认安装路径就可以。
3. 复制mm.mysql-2.0.4-bin.jar文件分别到C:/j2sdk1.4.2/lib 和 C:/Tomcat 5.0/common/lib
4.设置环境变量(桌面->我的电脑->右键点击->选择“属性”->高级->环境变量),所有 设置均在系统变量栏进行。
新建->变量名:JAVA_HOME
    ->变量值:C:/j2sdk1.4.2
新建->变量名:TOMCAT_HOME
    ->变量值:C:/Tomcat 5.0
新建->变量名: PATH
    ->变量值:.;C:/j2sdk1.4.2/bin;  (前面的 “.;”一定要有)
修改增加环境变量 CLASSPATH (如果没有此变量名,则新建)
    ->增加变量值:.;C:/j2sdk1.4.2/lib/dt.jar;C:/ j2sdk1.4.2/lib/tool.jar;
C:/j2sdk1.4.2/lib/NetComponents.jar;
C:/j2sdk1.4.2/lib/mm.mysql-2.0.4-bin.jar;
C:/Tomcat 5.0/common/classes;
C:/Tomcat 5.0/common/lib;
C:/Tomcat 5.0/common/lib/servlet-api.jar;
(前面的“.;”一定要有)

      5. 启动Tomcat服务器,打开浏览器,浏览:http://localhost:8080/ ,出现Tomcat欢迎页面;如果这步出现异常,请检查安装源文件,重新安装。


   三、整合Apache+Tomcat服务器

1. 复制mod_jk_1.2.5_2.0.47.dll文件到C:/Apache2/modules目录。
2. Apache配置:
C:/apahce2/conf/httpd.conf
httpd.conf
在此配置文件最后添加以下语句,用以支持jsp程序:
LoadModule jk_module modules/mod_jk_1.2.5_2.0.47.dll

JkWorkersFile "C:/Tomcat 5.0/conf/workers.properties"
JkMount /servlet/* ajp13
JkMount /*.jsp ajp13

3. 查看C:/Tomcat 5.0/conf/server.xml文件中有关端口“8009”是否被注释,如果是和我这的版本一致的话,不用修改。
4. 在C:/Tomcat 5.0/conf/目录下,新建文件名为“workers.properties”的文件,将如下内容复制到新建文件 workers.properties中。

workers.properties
# 只复制以下内容即可:

# 这现行根据安装目录做修改
workers.tomcat_home=C:/Tomcat 5.0
workers.java_home=C:/j2sdk1.4.1_01
ps=/
# worker.list=ajp13
worker.list=ajp12,ajp13  

worker.ajp12.port=8007
worker.ajp12.host=localhost
worker.ajp12.type=ajp12
worker.ajp12.lbfactor=1
             
worker.ajp13.port=8009         
worker.ajp13.host=localhost      
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1

worker.loadbalancer.type=lb

worker.loadbalancer.balanced_workers=ajp12, ajp13
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)classes
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)jaxp.jar

worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)parser.jar

worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)jasper.jar

worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)servlet.jar

worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)webserver.jar

worker.inprocess.class_path=$(workers.java_home)$(ps)lib$(ps)tools.jar

worker.inprocess.cmd_line=-config

worker.inprocess.cmd_line=$(workers.tomcat_home)/conf/jni_server.xml

worker.inprocess.cmd_line=-home

worker.inprocess.cmd_line=$(workers.tomcat_home)

worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)jvm.dll


worker.inprocess.stdout=$(workers.tomcat_home)$(ps)inprocess.stdout

worker.inprocess.stderr=$(workers.tomcat_home)$(ps)inprocess.stderr

worker.inprocess.sysprops=tomcat.home=$(workers.tomcat_home)


          5. 到此Apache 和 Tomcat整合完成,重启Apache和Tomcat服务器,
用编辑器编写如下内容:

<%@ page contentType="text/html;charset=gb2312"%>

<html>
<head>
<title>HI-JSP实验</title>
</head>
<body>
<%
  String Msg = "This is JSP test! 看到这段话,恭喜你,成功了!";  
  out.print("Hello World!");
%>
<h3><%=Msg%></h3>
The current date and time is <%=new java.util.Date() %>
<br>
<%
  String str = "Using trim() and substring() can be very useful";
  out.println(str);
%>
</body>
</html>

保存文件名为“test.jsp”到C:/Tomcat 5.0/webapps/ROOT目录,然后打开浏览器,浏览:http://localhost:8080/test.jsp,如果显示正常,然后将地 址改为:http://localhost/test.jsp  显示正常说明配置成功。严格按以上说明安装配置,都会一次成功。

  四、整合Apache+Tomcat+MySQL
    
      这步相对简单许多,但也是最不容易成功的部分,前面已经将JSP的MySQL 驱动放到相应的目录中,环境变量也设置,所以只是测试JSP是否可以连接MySQL数据库。

      1. 测试1,用编辑器编写如下内容:

<%@ page contentType="text/html;charset=gb2312" %>
<%
java.sql.Connection conn;
java.lang.String strConn;
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
conn= java.sql.DriverManager.getConnection("jdbc:mysql://localhost/test","root","");
%>
      注:数据库此处为:test 连接数据库存的用户名为:root  密码为空。根据自己数据库作相应修改。

保存文件名为“test-mysql.jsp”到C:/Tomcat 5.0/webapps/ROOT目录,然后打开浏览器,浏览:http://localhost:8080/test-mysql.jsp 或 http://localhost/test-mysql.jsp ,运行后,如果显示为空白页面,说明连接数据库成功,否则说明没有连接成功,请往回逐步仔细配置。

      2. 测试2,用编辑器编写如下内容:



<%@ page contentType="text/html;charset=GBK" %>
<%@ page language="java" import="java.sql.*"%>
<%
Connection conn = null;
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
conn = java.sql.DriverManager.getConnection("jdbc:mysql://localhost/test","root","");
if(conn==null){
System.out.println("get Conn Error");
}
Statement stmt=conn.createStatement();
ResultSet RS_result=null;
%>
<html>
<head>
<title>测试</title></head>
<body>
<%
RS_result=stmt.executeQuery("select * from guestbook");
String Name;
while(RS_result.next())
{
Name=RS_result.getString("name");
%>
<%=Name%>
<%
}
RS_result.close();
stmt.close();
conn.close();
%>
</body>
</html>

保存文件名为“test-mysql2.jsp”到C:/Tomcat 5.0/webapps/ROOT目录,然后打开浏览器,浏览:http://localhost:8080/test-mysql2.jsp 或 http://localhost/test-mysql2.jsp ,运行后。




五、安装Resin,整合Apache+Resin

1. 假定机子上现在没有启动别的JSP解析服务器,如果启动请关闭该服务。
2. 直接解压Resin-3.0.3.zip到C:/
3. 在字符模式下用命令:C:/resin-3.0.3/bin/httpd –install
将Resin安装为系统的一个服务,然后在服务中启动Resin.
删除服务命令:C:/resin-3.0.3/bin/httpd –remove
4. 打开浏览器,浏览:http://localhost:8080 ,如果显示有Resin信息,则Resin服务已经启动 。
5. Apache配置:
C:/apahce2/conf/httpd.conf
     
httpd.conf
在此配置文件最后添加以下语句:

    LoadModule caucho_module C:/resin-3.0.3/libexec/apache-2.0/mod_caucho.dll

    <IfModule mod_caucho.c>
      ResinConfigServer localhost 6802
      <Location /caucho-status>
      SetHandler caucho-status
      </Location>
    </IfModule>

    AddHandler caucho-request jsp
    <Location /servlet/*>
     SetHandler caucho-request
    </Location>

      保存,重启apache.

      6. Resin配置:
        C:/resin-3.0.3/conf/resin.conf

resin.conf
修改默认目录,红色部分为修改内容:
<server>
  <host id="">
    <document-directory>C:/Apache2/htdocs</document-directory>
    ...
  </host>
</server>


      完成后保存,重启Resin服务,把编辑好的JSP文件存放到C:/ Apache2/htdocs目录,然后打开浏览器浏览,就可以在PHP和JSP之间自由窜越了。

Window 2K 上 Apache-2.0.47 + Tomcat-4.1.27 + JK-2.0.4 的整合     选择自 ljcao 的 Blog
关键字  Window 2K 上 Apache-2.0.47 + Tomcat-4.1.27 + JK-2.0.4 的整合
出处 

1.  软件获取:
    Apache:去http://httpd.apache.org/download.cgi 下载;
    JDK:去http://jakarta.apache.org/site/binindex.cgi下 载(我的是1.4.2);
    Tomcat:去http://apache.bestwebcover.com/jakarta/tomcat-4/下 载;
    JK:去http://mirrors.mix5.com/apache/jakarta/tomcat-connectors/jk2/binaries/win32/ 下载。

2. 安装Apache、JDK和Tomcat,这就不用说了吧。

3.  将获取的Apache版的JK包jakarta-tomcat-connectors-jk2.0.4-win32-apache2.0.49.zip解 压缩到JK目录,将JK/conf/mod_jk2.conf.sample和JK/conf/workers2.properties.sample复 制到Apache/conf/目录下,并改名为mod_jk2.conf和workers2.properties,用文本编辑器打开 mod_jk2.conf文件,将"/usr/local/etc/apache2/workers2.properties"改为 workers2.properties文件的绝对路径,我的是"JkSet config.file "E:/Apache2047/conf/workers2.properties"";将JK/modules/mod_jk2.so复制到 Apache的modules/目录下,JK/doc/目录是一些说明文档,有兴趣你可以看看。

4. 用文本编辑器打开Apache/conf/httpd.conf文件,找到LoadModule 语句,在LoadModule 区域的最后面加一句"LoadModule jk2_module "modules/mod_jk2.so"";

5. 最后,重新启动Apache和tomcat。(命令行:net stop apache2、tomcat/bin/shutdown.bat;net start apache2、tomcat/bin/startup.bat)

6. 在浏览器访问http://localhost/jkstatus将 会看到JK的运行状态信息,访问http://localhost/examples/ 将会看到Tomcat的示例页面,整合完毕。

7. BTW,如果你想在Apache中添加更多的Tomcat虚拟目录,请在workers2.properties中添加。

最新整理apache-2.0.43和tomcat-4.1.12集成


作者:luyongshou 2005-02-02 15:04:45 来自:Linux先生

 在此介绍一下我在RedHat Linux 7.2下装Apache与Tomcat4整合的过程,重点讲述mod_webapp.so的制作方法,
  以及在虚拟主机环境下的配置、管理和应用,经测试已经成功。希望对各位有所帮助,如有错误也请指正。

一、正确安装Tomcat4
  必要软件的安装,如下:
  1、Java SDK
  版本1.3.1或1.4,建议安装在/usr/java下,并做一个jdk的软链接。
  如果在装版本1.3.1的SDK出现问题,请阅读文档:http://java.sun.com/j2se/1.3/install-linux-sdk.html
  2、Tomcat4
  建议安装最新release版本的二进制文件安装包。当前最新的tomcat版本是4.1.12。
  下载地址:
  http://jakarta.apache.org/builds/ja...t-4.1.12.tar.gz
  下载后接压到一个目录 "tar xvzf jakarta-tomcat-4.1.12.tar.gz"
本例将tomcat安装在/opt目录下,并做了个tomcat的软链接。
  设置如下环境变量并启用:
  PATH=$PATH:/usr/java/jdk/bin:/usr/java/jdk/jre/bin
  JAVA_HOME=/usr/java/jdk
  export JAVA_HOME
  CLASSPATH="./:/usr/java/jdk/lib:/usr/java/jdk/jre/lib"
  export CLASSPATH
  CATALINA_HOME=/opt/tomcat
  export CATALINA_HOME

  建议单建一个用户tomcat,将其设成/opt/tomcat以下所有目录文件的属主,并由它启动tomcat:
  # useradd tomcat
  # chown -R tomcat:tomcat /opt/tomcat
  # su - tomcat -c "/opt/tomcat/bin/startup.sh"

  访问http://localhost:8080/ 应能看到tomcat安装成功的页面。


===================================================================
如果想和apache集成需要修改tomcat/conf/server.xml这个文件的

<!-- Define an Apache-Connector Service -->

<Service name="Tomcat-Apache">
<!--
<Connector className="org.apache.catalina.connector.warp.WarpConnector"
port="8008" minProcessors="5" maxProcessors="75"
enableLookups="true" appBase="webapps"
acceptCount="10" debug="0"/>

<Engine className="org.apache.catalina.connector.warp.WarpEngine"
name="Apache" debug="0">

<Logger className="org.apache.catalina.logger.FileLogger"
prefix="apache_log." suffix=".txt"
timestamp="true"/>

<Realm className="org.apache.catalina.realm.MemoryRealm" />

</Engine>

</Service>
-->
</Server>

中的"<!--"和"-->"删掉,其实就是解除注释,因为这个网站是专门用来和apache的集成的。

二、Apache与Tomcat4的整合

  1、首先安装Apache,
  请注意Apache必须安装DSO模式,即在执行./configure时须加上 --enable-module=so

  默认安装到/usr/local/apache目录下。本例安装的apache的版本是2.0.43系列的。

  2、制作mod_webapp.so
  需要以下软件包:
  jakarta-tomcat-connectors-4.x.xx-src.tar.gz
  下载地址在tomcat对应版本的src目录下。例如,我安装的tomcat版本是4.1.12,则现在所需要的软件包的位置是:
  http://jakarta.apache.org/builds/ja...1.12-src.tar.gz
  apr-0.9.1.tar.gz
  下载地址:http://www.apache.org/dist/apr/apr-0.9.1.tar.gz
  autoconf-2.52-ximian.1.i386.rpm
  下载地址:http://rpmfind.net/linux/RPM/helix/...ian.1.i386.html
  先用rpm安装autoconf-2.52,因为下面的安装将要用到;
  然后解开jakarta-tomcat-connectors-4.1.12-src.tar.gz,生成jakarta-tomcat- connectors-4.1.12-src目录,
  进入jakarta-tomcat-connectors-4.1.12-src/webapp的目录里,再把apr-0.9.1.tar.gz解到 这个目录下,
  并把刚生成的目录apr-0.9.1的目录名改成apr。
  还是在webapp目录,运行以下命令:
  # support/buildconf.sh
  此时如果autoconf的版本低于2.52的话会报错退出,所以必须先安装autoconf-2.52。
  当命令成功结束后会在当前目录下生成configure文件。
  依次运行以下命令:

  # ./configure --with-apxs=/usr/local/apache/bin/apxs
  # make
  # cp apache-2.0/mod_webapp.so /usr/local/apache/modules

  现在mod_webapp.so已经制作好了,并已经拷贝到apache的modules目录下。
  编辑apache的配置文件,在最后加上如下几行:
  ==========================
  LoadModule webapp_module modules/mod_webapp.so
  WebAppConnection Connector warp localhost:8008
  WebAppDeploy examples Connector /examples
  ==========================

  运行以下命令:
  # /usr/local/apache/bin/apachectl configtest

如果出现错误说你的apache的httpd.conf有问题后面的错误是"inviad virual host"

就说明你的httpd.conf的ServerName没有设,把ServerName前面的"#"去掉就可以了!(这是差了好多资料才得到的答案,我也 是在这儿困惑了好多天了)

  只要出现“Syntax OK”就表明mod_webapp.so已经安装成功了。
  启动apache
  # /usr/local/apache/bin/apachectl start
  访问http://localhost/examples 就可以看到tomcat的例子程序了。

注意:一定要先启动tomcat 然后再重新启动apache!

三、虚拟主机下的配置、管理和应用

  下面以一个例子来说明虚拟主机如何同时使用Apache与Tomcat4

  虚拟主机host1的目录结构如下所示:


  /www               
   |---host1  虚拟主机host1的主目录
   |  |--htdocs  普通根目录:用于显示静态页面或php程序
   |  |----logs  apache访问日志
   |  |----webapps java应用目录(新加,与tomcat的webapps目录无任何关联)
   |     |--ROOT jsp根目录:用于显示jsp页面程序
   |     |----jive 一套java应用实例
   |---host2   虚拟主机host2的主目录
  ............



  原来的apache的配置文件是这样配置的:


  =====================================
  NameVirtualHost xxx.xxx.xxx.xxx

  < VirtualHost xxx.xxx.xxx.xxx >
  ServerName host1.mydomain.com
   ServerAdmin webmaster@mydomain.com
   DocumentRoot /www/host1/htdocs
   ErrorLog /www/host1/logs/error_log
  CustomLog /www/host1/logs/access_log common
  < /VirtualHost >
  .............

  =====================================



  现在要让虚拟主机host1能同时使用Apache与Tomcat4,需要做如下配置:

  1、编辑tomcat的配置文件server.xml,在最后的部分做如下修改:


  =====================================
  < !-- Define an Apache-Connector Service -- >

  < Service name="Tomcat-Apache" >

  < Connector className="org.apache.catalina.connector.warp.WarpConnector"
  port="8008" minProcessors="5" maxProcessors="75"
  enableLookups="true" appBase="webapps"
  acceptCount="10" debug="0"/ >

< Engine className="org.apache.catalina.connector.warp.WarpEngine"
  name="Apache" debug="0" >

  < Logger className="org.apache.catalina.logger.FileLogger"
  prefix="apache_log." suffix=".txt"
timestamp="true"/ >

  < Realm className="org.apache.catalina.realm.MemoryRealm" / >

< !-- 下面是新加的内容 -- >

  < Host name="host1.mydomain.com" debug="0" appBase="/www/host1/webapps"
uppackWars="true" autoDeploy="true" >
  < Context path="" docBase="ROOT" debug="0"/ >
< !-- 下面套用的是tomcat自带的管理页面,在虚拟主机下也可使用 -- >
< Context path="/manager" debug="0" privileged="true"
  docBase="/opt/tomcat/server/webapps/manager"/ >
  < Context path="/jive" docBase="jive" debug="0"
reloadable="true" crossContext="true"/ >
  < Logger className="org.apache.catalina.logger.FileLogger"
prefix="host1_log." suffix=".txt"
  timestamp="true"/ >
  < /Host >

< !-- 新加内容结束 -- >

< /Engine >

  < /Service >
  =====================================
  2、编辑tomcat的管理权限文件tomcat-users.xml,在中间加一行:
< user username="myname" password="mypasswd" roles="standard,manager"/ >
  3、编辑apache的配置文件,做如下修改
  =====================================
  LoadModule webapp_module libexec/mod_webapp.so
  AddModule mod_webapp.c
  WebAppConnection warpConnection warp localhost:8008
  NameVirtualHost xxx.xxx.xxx.xxx
  < VirtualHost xxx.xxx.xxx.xxx >
  ServerName host1.mydomain.com
   ServerAdmin webmaster@mydomain.com
   DocumentRoot /www/host1/htdocs
   ErrorLog /www/host1/logs/error_log
   CustomLog /www/host1/logs/access_log common

   WebAppDeploy ROOT warpConnection /

  #注:此行的作用是把ROOT目录作为虚拟主机URL的根,并使前面定义的根htdocs失效。
  #但如果不想整个虚拟主机都使用jsp页面程序,而想使用大量静态页面或php程序的话,
  #就要使用下面这行,并把所有的静态页面和php程序放在htdocs目录下。
  # WebAppDeploy ROOT warpConnection /jsp

   WebAppDeploy manager warpConnection /manager
  WebAppDeploy jive warpConnection /jive
  #在server.xml里每定义一个都要在这里加一条WebAppDeploy。

  < /VirtualHost >
  =====================================

  4、将tomcat用户设成/www/host1/webapps以下所有目录文件的属主。

  要注意的是,以后如果想上传或改动该目录以下的文件,都要将其属主改成tomcat。
  (如果一直是以root身份运行tomcat,这步可以省略。)

  # chown -R tomcat:tomcat /www/host1/webapps
  5、重起tomcat:
  # su - tomcat -c "/opt/tomcat/bin/shutdown.sh"
  # su - tomcat -c "/opt/tomcat/bin/startup.sh"
  6、重起apache:
  /usr/local/apache/bin/apachectl restart

  此时访问http://host1.mydomain.com/manager/html 会提示输入密码,在输入正确的 myname和mypasswd后,就会看到“Tomcat Web Application Manager”的页面,里面的 Application Path已经是虚拟主机里配置的信息了,并可以对其进行管理。
  到此虚拟主机下的配置和管理就全部完成,剩下的事情就是测试和应用了。在上面的例子
  里我们已经安装了jive,经测试已经可以正常运行

嵌入式GUI显示驱动配置实战:从emWin硬件接口到SPI屏驱动优化 在嵌入式系统开发中,显示驱动是连接GUI库与物理屏幕的核心底层模块,其本质是CPU与显示控制器之间的数据“翻译”与“传输”系统。其工作原理是通过实现特定的硬件抽象层接口,将GUI生成的图形数据转换为屏幕能识别的时序和协议。这项技术的核心价值在于,它允许开发者在资源受限的MCU上,通过适配不同的硬件接口,以最小的硬件开销实现稳定的图形输出。其典型应用场景包括智能家居面板、工业HMI、可穿戴设备等嵌入式图形界面开发。本文将深入解析emWin GUI库的驱动框架,重点探讨如何针对SPI、I2C等串行接口进行高效的 阅读详情

相关推荐

C# HttpClient 实战:3步绕过Cloudflare指纹拦截,获取完整网页内容

本文详细介绍了如何使用C# HttpClient绕过Cloudflare指纹拦截,获取完整网页内容的3步实战方案。通过完美复制浏览器请求头、智能管理Cookie容器以及处理动态挑战页面,开发者可以有效突破Cloudflare的反爬机制,适用于爬虫开发和数据采集项目。

weixin_31856057的博客 323

Apache2.0.47和Tomcat4.1.27整合

 一、准备需要以下程序:j2sdk1.4.2_01,apache-2.0.47,jakarta-tomcat-4.1.27,以及mod_jk2-2.0.43.dll以上程序都可以在sun和apache.org下载到。j2sdk1.4.2_01 : http://java.sun.com/j2se/1.4.2/download.html选J2SE v 1.4.2_01 的SDKapache-2.0.

yown的专栏 1193

FPGA从入门到精通(2) - LUT

LUT:(look up table) 查找表 今天我要讲的与FPGA CLB相关的第一节LUT。根据上一节课的课程大纲,讲CLB应该是讲SLICEL(SLICEM)。不过当我打开用户手册,看了一下SLICE的结构(图一),一眼望去,这是分分钟会劝退入门者。为了让读者更好的接受以及理解,所以我打算先讲清楚它里面的每一个基本单元(LUT, 进位链,MUX,寄存器,几乎所有的FPGA器件的SLICE都是这四大件组成,只是组合不太一样而已),然后再将他们联系在一起,和读者一步步推倒出SLICE的结构。 图1​

Jasper灬兰的博客 1万+

最新整理apache-2.0.43和tomcat-4.1.12集成

在此介绍一下我在RedHat Linux 7.2下装Apache与Tomcat4整合的过程,重点讲述mod_webapp.so的制作方法,  以及在虚拟主机环境下的配置、管理和应用,经测试已经成功。希望对各位有所帮助,如有错误也请指正。 一、正确安装Tomcat4  必要软件的安装,如下:  1、Java SDK  版本1.3.1或1.4,建议安装在/usr/java下,并做一个jdk的软链接。 

eyejava的专栏 904

模糊控制——基本原理(附MATLAB程序)

模糊化:使用隶属函数将实际输入转换为模糊集合的隶属度值。规则库:利用“如果-那么”规则将模糊输入映射到模糊输出。推理机制:通过规则的模糊化和模糊集合的合成,生成模糊输出。去模糊化:将模糊输出转换为具体的控制信号,常用的方法包括质心法和最大隶属度法。这些步骤综合起来,实现了模糊控制系统对复杂和不确定系统的有效控制。模糊控制系统通过结合模糊逻辑和规则库来处理复杂系统中的不确定性和模糊性。它的核心在于模糊集合和隶属函数,通过推理机处理模糊规则,并最终通过去模糊化生成具体的控制信号。

qq_35623594的博客 5561

无感健康监测的未来:毫米波雷达如何重新定义睡眠科技与居家养老

毫米波雷达技术正重新定义无感健康监测,特别是在睡眠科技与居家养老领域。通过精准监测呼吸、心率和体动,无需穿戴设备即可实现临床级精度。结合合宙Air700E开发板,构建了完整的远程看护解决方案,为老年人提供跌倒检测、异常报警等安全保障,同时保护用户隐私。

cake8的博客 571

Apache2.0.43 + Tomcat4.1.18 + mod_jk-2.0.43.dll整合

  Apache2.0.43 + Tomcat4.1.18 + mod_jk-2.0.43.dll整合Author:Haley             Date:2003-02-20 一、软件准备:(操作系统Windos 2000 Server)    1.j2sdk1.4.1:  到http://java.sun.com/j2se/1.4.1/download.html下载!

haley_hj的专栏 1431

深入解析Vivado FIFO的Standard与FWFT模式:性能对比与应用场景

本文深入解析了Vivado FIFO的Standard与FWFT两种工作模式的核心差异。通过对比数据就绪时机、读延迟、控制逻辑和有效深度等关键特性,并结合图像处理、数据包转发等典型应用场景,为FPGA设计者提供了清晰的选择依据和实战配置指南,帮助优化数据流性能与设计效率。

weixin_29219189的博客 260

How To for Apache2, Tomcat4.1.x, mod_jk2, JSDK1.4 on Win2k

How To for Apache2, Tomcat4.1.x, mod_jk2, JSDK1.4 on Win2k (写给那些和我一样曾经无法在WIN2K下成功的用JK2整合APACHE2+TOMCAT4的人)Quick and Dirty, no thinking version here for those who just want to blast it in. 

BluePenguin的专栏 1449

openEuler 22.03 安装 openGauss 5.0.2 部署手册

openEuler 22.03 安装 openGauss 5.0.2 部署手册

全国服务器高效代维 1441

[SoC]SoC验证中bootcode与firmware相关验证经验总结

本文总结了SoC验证中bootcode和firmware的验证经验。重点介绍了两种数据加载方法:1)使用Verilog系统函数$readmemh/$readmemb直接写入ROM/ARAM,需注意文件路径、格式和斜杠方向;2)通过Memory Hierarchy在initial块中操作,需要添加适当延时并注意路径拼接。文章还提供了在testcase phase中先读取数据到HASH再写入SRAM的示例,并强调加载后需使能edc_bypass以避免ECC错误。验证过程中需特别注意文件位置、格式要求及路径处理等

元直的博客 2500

Windows2000下的Apache2与Tomcat4的整合

google_ad_client = "pub-8800625213955058";/* 336x280, 创建于 07-11-21 */google_ad_slot = "0989131976";google_ad_width = 336;google_ad_height = 280;//<script type="text/java

java专栏 471

【Simulink教程案例7】基于Simulink的滑模控制器设计与实现

欢迎订阅滑膜控制是一种变结构控制策略,其和常规控制方法的主要区别在于控制的不连续性,即一种使系统结构随时间变化的开关特性。所以,滑膜控制器也叫做变结构控制器,其本质是一类特殊的非线性控制器,并且这种非线性为不连续性。滑膜控制器和其他控制方式最大的区别在于其结构的不固定性,在其工作过程中,系统当前的状态会发生变化,使得系统按照预先设置的“滑动模态”的状态轨迹运动。正是由于这个特点,滑膜控制器具有快速响应的优点。滑模控制的基本定义如下所示:1).穿越切换面上的某个点;2).从切换面上的某个点离开;

FPGA/MATLAB学习教程/源码/项目合作开发 3246

Windows2000 server和windows 2003下的Apache2.0.47与Tomcat5.0.4的整合配置方法

j2sdk-1_4_1_02-s1studio_ce-4u1-bin-windows.exe+jakarta-tomcat-5.0.4.exe原由:搞了一段时间的java项目,到发布的时候了,可找不到一份最新的Apache2.0.47与Tomcat5.0.4的整合配置,遂看了半天的jakarta在线资料,并参照以前网友的文章,写了这篇配置文档,以作参考,欢迎斧正!一、软件准备:假设你有一台

lycoo的专栏 1267

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

suse 12 sp2 安装jdk和tomcat

一、安装jdk1.8.0_161 1.检查一下系统中的jdk版本 java -version 2.检测jdk安装包 rpm -qa | grep java 3.如果有卸载 比如: rpm -e --nodeps tzdata-java-2018b-1.el7.noarch 4.创建并将jdk包拷贝到/usr/local/java下 mkdir /usr/local/java mv jdk-8u16...

qq_41592706的博客 858

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

apache-tomcat-8.0.43源码编译

源码下载 到https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.43/src/ 下载对应版本源码,本文编译的是apache-tomcat-8.0.43-src 用idea 来编译 在src目录下加入pom.xml文件,使用maven来编译。 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"

mg0324的专栏 733

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

Centos 6/7 安装Apache2.4.37+Tomcat连接

Index of /dist/apr

jolly10的专栏 1234

Apache2.0.43+Tomcat4.1.18+J2sdk1.4.1+Sql2000连接池配置

 一、 所用文件1、 apache_2.0.43-win32-x86-no_ssl.msi——apache2.0.43web服务器;2、 j2sdk-1_4_1_02-windows-i586.exe ——jdk1.4.1;3、 mod_jk-2.0.43.dll——Apache和Tomcat结合所需的链接文件;4、 tomcat-4.1.18.exe——应用服务器tomcat4.

赵小刀的文字吧 1351

在Windows2000平台下整合JDK1.4.1 + Apache2.0.44 + Tomcat4.1.18完全解决方案

在Windows2000平台下整合JDK1.4.1 + Apache2.0.44 + Tomcat4.1.18完全解决方案软件环境:1. Windows 2000 Professional + SP32. JDK 1.4.1_02 (http://java.sun.com)3. Apache 2.0.44 (http://www.apache.org)4. Tomcat 4.1.18 (http:

lycoo的专栏 1655

Win2000下Tomcat4.1.12 Apache2.0.43的配置

本人最近为了项目上的需要,一直在寻找Tomcat4.1.12 Apache2.0.43的方法。但从网上查找了很多中文网站,多是较低版本或配置比较复杂。后来参照了国外经验总结方面的网站,找到了自认为还算简单的整合方法。现介绍如下,算是抛砖引玉吧。一.软件安装及PATH等设置:这一步没什么说的,按J2SDK1.4.1(当然也可以是其他版本的),Apache2.0.43,Tomcat4.

915

Apache2.0.43+Tomcat 整合说明书

Apache2.0.43与Tomcat4.1.12的整合安装说明1.    软件准备    11.1.    window2000    11.2.    Apache2.0.43    11.3.    Tomcat4.1.12    21.4.    j2sdk1.4.1    21.5.    mod_jk-2.0.43.dll    22.    环境准备    23.    软件安装  

1183

Apache2.0.43 + Tomcat4.1.18 + mod_jk-2.0.43.dll整合 (转)

Apache2.0.43 + Tomcat4.1.18 + mod_jk-2.0.43.dll整合 (转)[@more@] apache2.0.43 + tomcat4.1.18 + mod_jk-2.0.43.dll整合...

csd3176的博客 247

Windows2000 server下的Apache2.0.47与Tomcat4.1.27的整合配置方法

 这两天为了架设一个学习jsp的环境,参考网上的文章,折腾了2天才搞定Apache2+tomcat4.1的整合,下面我的整合总结。如果你参考这篇文章遇到问题请和我联系shanyougz@21cn.com一、            软件准备:假设你有一台能正常运行win2000 server的软硬件环境。1、j2sdk1.4.1: 到 http://java.sun.com/j2se/下

shanyou的专栏 2528

Win2K下Apache2+TomCat5.0整合解决方案

Win2K下Apache2.0+TomCat5.0解决方案 操作系统:windows 2000 professional 中文版+sp4java 环境:j2sdk1.4.2_01 JAVA_HOME= C:/j2sdk1.4.2_01apache 2.0.48 for win32:apache_2.0.48-win32-x86-no_ssl.msi下载地址http://arc

Three_H的专栏 1198

Tomcat9.0.43源码maven构建及相关问题解决

下载源码 https://tomcat.apache.org/download-90.cgi 解压 新建catalina-home文件夹,将conf、webapps两个文件夹剪切至catalina-home 将如下配置保存为pom.xml放入tomcat目录 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xml.

予早随笔 1576

WinXP Pro 上整合 Apache 2.0.48 + Tomcat 5.0.19

WinXP Pro 上整合 Apache 2.0.48 + Tomcat 5.0.19 软件准备:Apache 2.0.48http://apache.linuxforum.net/dist/httpd/binaries/win32/apache_2.0.48-win32-x86-no_ssl.msiTomcat 5.0.19http://apache.linuxforum

[无色轨迹] @ Naxin9999 1606
上一篇: 经理人必看的十个管理网站
下一篇: Google's 1Q Profit Soars to Nearly Six-Fold Improvement
anperl
博客等级 码龄24年 1粉丝 33原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值