Tomcat-Apache HOWTO Tomcat+Apache HOWTO

【主机漏洞扫描常见修复方案】:Tomcat安全(机房对外Web服务扫描) 【代码】运维小技能:Tomcat安全(机房对外Web服务扫描) 阅读详情
 

The Jakarta Project

The mighty Tomcat - Meow!

Tomcat-Apache HOWTO

This document explains how to connect Tomcat to the popular open source web server, Apache. It was originally part of Tomcat: A Minimalistic User's Guide by Gal Shachor, but has been split off for organizational reasons. It should be considered a work in progress. Since the Tomcat source tree is constantly changing, the information herein may be out of date. The only definitive reference at this point is the source code.

Other important documents:

Other Tomcat-Apache HOWTOs: [should be integrated into this one?]

Table of Contents

  • [write me]

Apache - Tomcat Cooperation - Sample Server Integration

Up until now we have not discussed Tomcat as a server add on, instead we have considered it as a stand-alone container and discussed how it can be used.  There are however a few problems with this picture:

  1. Tomcat is not as fast as Apache when it comes to static pages.
  2. Tomcat is not as configurable as Apache.
  3. Tomcat is not as robust as Apache.
  4. There are many sites with long time investment in certain web servers, for example, sites that are using CGI scripts/Server API modules/perl/php.  We cannot assume that all of them will want to ditch this legacy.

For all these reasons it is recommended that real world sites use an industrial strength web server, such as Apache, for serving the static content of the site, and use Tomcat as a Servlet/JSP add-on.

Our agenda:

  1. Cover the fundamental behavior of the web server.
  2. Explain what configuration is needed.
  3. Demonstrate this on Apache.

Common Installation and Configuration Problems

This section isn't meant to be your one-stop shop for all troubles Tomcat, but a resource for stumbling blocks common to many first-time Tomcat'ers.  See the help section for additional links.

    http://webserver:8007/ gives a 500

This is what you should see in your tomcat.log file:

HANDLER THREAD PROBLEM: java.io.IOException: Stream broken

By default, Tomcat listens for AJP connections on port 8007.  AJP is the protocol used to communicate between the web server and Tomcat, not Tomcat and your browser.  To test your Tomcat installation, FIX ME ?

    <Directory> and <Location> directives ignored

FIX ME Apache never applies because forwarded to Tomcat.

    Web server won't start when Tomcat is running

FIX ME Port conflict.

    "Bad command or filename" when executing Tomcat scripts

[FIX ME] UNIX file format on DOS.  Because Tomcat is developed on *nix (rather, the jars are built and distributed there), you may have to convert the files to PC (versus UNIX) format.


Starting Tomcat From Another Directory

Setting Tomcat to Cooperate with the Apache Web Server

Web Server Operation

In a nutshell a web server is waiting for client HTTP requests. When these requests arrive the server does whatever is needed to serve the requests by providing the necessary content. Adding a servlet container may somewhat change this behavior. Now the web server needs also to perform the following:

  • Load the servlet container adapter library and initialize it (prior to serving requests).
  • When a request arrives, it needs to check and see if a certain request belongs to a servlet, if so it needs to let the adapter take the request and handle it.
The adapter on the other hand needs to know what requests it is going to serve, usually based on some pattern in the request URL, and to where to direct these requests.

Things are even more complex when the user wants to set a configuration that uses virtual hosts, or when they want multiple developers to work on the same web server but on different servlet container JVMs. We will cover these two cases in the advanced sections.

What is the Needed Configuration

The most obvious configuration that one can think of is the identity of the servlet URLs that are under the responsibility of the servlet container. This is clear; someone must know what requests to transmit to the servlet container... Yet there are additional configuration items that we should provide to the web-server/servlet-container combination:

  • We also need to provide configuration regarding the available Tomcat processes and on which TCP/IP host/port they are listening.
  • We need to tell the web server the location of the adapter library (so it will be able to load it on startup).
  • We need to set adapter internal information such as where and how much to log, etc.
All this information must appear either in the web server configuration, or in a private configuration files used by the adapter. The next section will demonstrate how configuration can be implemented on Apache.

Making it on Apache

This section shows you how to configure Apache to work with Tomcat; it tries to provide explanations as well as insight for the configuration directives that you should use. You can find additional information in the jserv install page .

When Tomcat starts up it will automatically generate a configuration file for Apache in TOMCAT_HOME/conf/jserv/tomcat-apache.conf. Most of the time you don't need to do anything but include this file (appending "Include TOMCAT_HOME/conf/jserv/tomcat-apache.conf") in your httpd.conf. If you have special needs, for example an AJP port other the 8007, you can use this file as a base for your customized configuration and save the results in another file. If you manage the Apache configuration yourself you'll need to update it whenever you add a new context.

Tomcat: you must restart tomcat and apache after adding a new context; Apache doesn't support configuration changes without a restart. Also the file TOMCAT_HOME/conf/jserv/tomcat-apache.conf is generated when tomcat starts, so you'll need to start Tomcat before Apache. Tomcat will overwrite TOMCAT_HOME/conf/tomcat-apache.conf each startup so customized configuration should be kept elsewhere.

The Apache-Tomcat configuration uses Apache core configuration directives as well as Jserv unique directives so it may confuse you at first, there are however two things simplifying it:

  • In general you can distinguish between the two directive "families" by noting that all the Jserv unique directives start with an "ApJServ" prefix.
  • The entire Tomcat related configuration is concentrated in a single configuration file named tomcat.conf, or the automatically generated tomcat-apache.conf, so you can look at a single file.
Lets look now at a sample tomcat.conf file.
A Minimalistic Apache-Tomcat Configuration
    
###########################################################
#      A minimalistic Apache-Tomcat Configuration File    #
###########################################################

# Note: this file should be appended or included into your httpd.conf

# (1) Loading the jserv module that serves as Tomcat's apache adapter.
LoadModule jserv_module libexec/mod_jserv.so

# (1a) Module dependent configuration.
<IfModule mod_jserv.c>

# (2) Meaning, Apache will not try to start Tomcat.
ApJServManual on
# (2a) Meaning, secure communication is off
ApJServSecretKey DISABLED
# (2b) Meaning, when virtual hosts are used, copy the mount
# points from the base server
ApJServMountCopy on
# (2c) Log level for the jserv module.
ApJServLogLevel notice

# (3) Meaning, the default communication protocol is ajpv12
ApJServDefaultProtocol ajpv12
# (3a) Default location for the Tomcat connectors.
# Located on the same host and on port 8007
ApJServDefaultHost localhost
ApJServDefaultPort 8007

# (4)
ApJServMount /examples /root
# Full URL mount
# ApJServMount /examples ajpv12://hostname:port/root
</IfModule>
            

As you can see the configuration process was split into 4 steps that will now be explained:

  1. In this step we instruct Apache to load the jserv shared-object (or the NT world dll). This is a well known Apache directive. If the loading went well and the module came from a file named mod_jserv.c (1a) we can start with the rest of the Jserv-Tomcat configuration.
  2. This step sets various Jserv internal parameters, these parameters:
    • Instruct jserv not to start the Tomcat process. Automatically starting Tomcat is not implemented yet.
    • Disable the secret key challenge/response between Apache and Tomcat. Again, the secret key work is not implemented yet.
    • Instruct jserv to copy the base server mount points (see next section) in case of virtual hosting.
    • Instruct jserv to use the notice log level. Other log levels include emerg, alert, crit, error, warn, info and debug.
  3. This step sets the default communication parameters. Basically it says that the default protocol used for the communication is ajpv12 (do not mess with this one) and that the Tomcat process runs on the same machine and listens on port 8007. If you run Tomcat on a machine other than the one used for Apache you should either update your ApJServDefaultHost or use a full URL when mounting contexts (see next). Also, if you configured the Tomcat connectors to use a port other then 8007, you should update your ApJServDefaultPort or use a full URL when mounting contexts.
  4. This step mounts a context to Tomcat. Basically it says that all the web server paths that start with /examples go to Tomcat. This ApJServMount example is a rather simple one, in fact ApJServMount can also provide information regarding the communication protocol to be used and the location where the Tomcat process listens, for example:
    ApJServMount /examples ajpv12://hostname:port/root
    mounts the context /examples to a Tomcat process that runs on host "hostname" and listens on port number "port".
Now that you understand the different configuration instructions in the sample file, how can you add it to the Apache configuration? One "simple" method is to write it's content in the httpd.conf (the Apache configuration file), this however can be very messy. Instead you should use the Apache include directive. At the end of the Apache configuration file (httpd.conf) add the following directive:
include <full path to the Tomcat configuration file>
for example:
include /tome/tomcat/conf/tomcat.conf
This will add your Tomcat configuration to Apache, after that you should copy the jserv module to the Apache libexec (or modules in the Win32 case) directory and restart (stop+start) Apache. It should now be able to connect to Tomcat.

Obtaining the Jserv Module (mod_jserv)

As previously stated, we need a web server adapter to sit in Apache and redirect requests to Tomcat. For Apache, this adapter is a slightly modified version of mod_jserv.

You may try to look here and see if there is an already pre-built version of mod_jserv that suites your OS (Usually there is one for NT), however, being a native library you should not expect that yet (too many OS's, not enough developers, life too short...). Moreover, small variations in the way you built Apache/Your specific UNIX variant may result in dynamic linking errors. You should really try to build mod_jserv for your system (don't panic, it is not that hard!).

Building mod_jserv on UNIX involves the following:

  1. Download the source distribution of Tomcat from here.
  2. Uncompress it into some directory.
  3. Building the module:
    • Change directory into jakarta-tomcat/src/native/apache/jserv/
    • Execute the build command
      apxs -c -o mod_jserv.so *.c
      apxs is part of the Apache distribution and should be located in your APACHE_HOME/bin.
Building mod_jserv for Win32 is less likely (you already have a downloadable dll for Win32). Yet if you want to build it you should install Visual C++ and perform the following:
  1. Download the source distribution of Tomcat from here.
  2. Unzip it into some directory.
  3. Building the module:
    • Change directory into jakarta-tomcat/src/native/apache/jserv
    • Add Visual C++ into your environment by executing the script VCVARS32.BAT.
    • Execute the build command
      nmake -f Makefile.win32
      nmake is the Visual C++ make program.
That's it; you have built mod_jserv...

Making Apache Serve your Context's Static Files

The previous Apache-Tomcat configuration file was somewhat inefficient, it instructed Apache to send any request for a resource that starts with the /examples prefix to be served by Tomcat. Do we really want that? There are many static files that may be a part of our servlet context (for example images and static HTML), why should Tomcat serve these files?

You may actually have reasons for doing that, for example:

  1. You may want to configure Tomcat based security for these resources.
  2. You may want to follow users requests for static resources using interceptors.
In general however, this is not that case; and making Tomcat save static files is just a CPU waste. We should instead have Apache serve these static files and not Tomcat. Lets look now at a sample tomcat.conf file that does exactly that:

Having Apache serve the static files requires the following:

  1. Instructing Apache to send all servlet requests to Tomcat.
  2. Instructing Apache to send all JSP requests to Tomcat.
and leaving Apache to handle the rest. Lets look now at a sample tomcat.conf file that does exactly that:
Apache-Tomcat Configuration where Apache Serves the Static Content
    
######################################################################
#              Apache-Tomcat Smart Context Redirection               #
######################################################################
LoadModule jserv_module modules/ApacheModuleJServ.dll
<IfModule mod_jserv.c>
ApJServManual on
ApJServDefaultProtocol ajpv12
ApJServSecretKey DISABLED
ApJServMountCopy on
ApJServLogLevel notice

ApJServDefaultHost localhost
ApJServDefaultPort 8007

#
# Mounting a single smart context:
#
# (1) Make Apache know about the context location.
Alias /examples D:/tomcat/webapps/examples
# (2) Optional, customize Apache context service.
<Directory "D:/tomcat/webapps/examples">
    Options Indexes FollowSymLinks
# (2a) No directory indexing for the context root.
#    Options -Indexes
# (2b) Set index.jsp to be the directory index file.
#    DirectoryIndex index.jsp
</Directory>
# (3) Protect the WEB-INF directory from tampering.
<Location /examples/WEB-INF/>
    AllowOverride None
    deny from all
</Location>
# (4) Instructing Apache to send all the .jsp files under the context to the 
# jserv servlet handler. 
<LocationMatch /examples/*.jsp>
    SetHandler jserv-servlet
</LocationMatch>
# (5) Direct known servlet URLs to Tomcat.
ApJServMount /examples/servlet /examples

# (6) Optional, direct servlet only contexts to Tomcat.
ApJServMount /servlet /ROOT
</IfModule>
      

As you can see, the beginning of this configuration file is the same as seen in the previous example. The last step (mounting a context), however, was replaced in a long series of Apache and ApJServ configuration directives that will now be explained:

  1. This step informs Apache of the context location and aliases it to an Apache virtual directory. This way Apache can serve files from this directory.
  2. This optional step instructs Apache more about how to serve the context; for example you can decide if Apache will allow directory indexing (listing) or set a special index file.
  3. This step instructs Apache to protect the WEB-INF directory from client access. For security reasons it is important to prevent visitors from viewing the content of the WEB-INF directory, for example web.xml can provide valuable information for intruders. This step blocks the WEB-INF content from visitors.
  4. This step instructs Apache to serve all the jsp locations within the context using the jserv servlet handler. The servlet handler redirects these requests based on the default host and port.
  5. This step mounts specific servlet URLs to Tomcat. You should note that you should have as many such mount directives as the number of specific servlet URLs.
  6. This last step is an example for the addition of servlet only context to Tomcat.
It is easy to see that this configuration is much more complex and error prone then the first example, this however is the price that you should (for now) pay for improved performance.

Configuring for Multiple Tomcat JVMs

Sometimes it is useful to have different contexts handled by different JVMs, for example:

  • When each context serves a different, specific task and runs on a different machine.
  • When we want to have multiple developers work on a private Tomcat process but use the same web server.
Implementing such schemes where different contexts are served by different JVMs is very easy and the following configuration file demonstrates this:

Apache-Tomcat Configuration with per Context JVM
    
######################################################################
#             Apache-Tomcat with JVM per Context                     #
######################################################################
LoadModule jserv_module modules/ApacheModuleJServ.dll
<IfModule mod_jserv.c>
ApJServManual on
ApJServDefaultProtocol ajpv12
ApJServSecretKey DISABLED
ApJServMountCopy on
ApJServLogLevel notice

ApJServDefaultHost localhost
ApJServDefaultPort 8007

# Mounting the first context.
ApJServMount /joe ajpv12://joe.corp.com:8007/joe

# Mounting the second context.
ApJServMount /bill ajpv12://bill.corp.com:8007/bill
</IfModule>
            

As you can see in the previous example, using several JVMs (even even those that run on different machines) can be accomplished easily by using a full ajp URL mount. In this full URL we actually specify the host where the Tomcat process is located and it's port.

Had the two Tomcat processes run on the same machine, we would have to configure each of them with different connector ports. For example, assuming that the two JVMs runs on localhost, the Apache-Tomcat configuration should have something that looks like:

Same Machine Multiple JVM Apache-Tomcat Configuration
    
######################################################################
#      Apache-Tomcat with Same Machine JVM per Context               #
######################################################################
LoadModule jserv_module modules/ApacheModuleJServ.dll
<IfModule mod_jserv.c>
ApJServManual on
ApJServDefaultProtocol ajpv12
ApJServSecretKey DISABLED
ApJServMountCopy on
ApJServLogLevel notice

ApJServDefaultHost localhost
ApJServDefaultPort 8007

# Mounting the first context.
ApJServMount /joe ajpv12://localhost:8007/joe

# Mounting the second context.
ApJServMount /bill ajpv12://localhost:8009/bill
</IfModule>
            

Looking at the above file you can see that we have two explicit ApJServ mount points each pointing to a different port on the same machine. It is clear that this configuration requires support from the configuration found in the server.xml files. We will need in these files different <Connector> configurations, for the different Tomcat processes. We will actually need two different server.xml files (lets call them server_joe.xml and server_bill.xml) with different <Connector> entries as shown in the next two samples:

Joe's server.xml file
    
<?xml version="1.0" encoding="ISO-8859-1"?>

<Server>
    <!-- Debug low-level events in XmlMapper startup -->
    <xmlmapper:debug level="0" />

    <!--  @@@
        Note, the log files are suffixed with _joe to distinguish
        them from the bill files. 
    -->

    <Logger name="tc_log" 
            path="logs/tomcat_joe.log"
            customOutput="yes" />

    <Logger name="servlet_log" 
            path="logs/servlet_joe.log"
            customOutput="yes" />

    <Logger name="JASPER_LOG" 
        path="logs/jasper_joe.log"
            verbosityLevel = "INFORMATION" />

    <!--  @@@
        Note, the work directory is suffixed with _joe to distinguish
        it from the bill work directory.
    -->
    <ContextManager debug="0" workDir="work_joe" >
        <!-- Context level Setup -->	
        <ContextInterceptor 
		    className="org.apache.tomcat.context.AutoSetup" />
        <ContextInterceptor 
		    className="org.apache.tomcat.context.DefaultCMSetter" />
        <ContextInterceptor 
		    className="org.apache.tomcat.context.WorkDirInterceptor" />
        <ContextInterceptor 
		    className="org.apache.tomcat.context.WebXmlReader" />
        <ContextInterceptor 
		    className="org.apache.tomcat.context.LoadOnStartupInterceptor" />
        <!-- Request processing -->
        <RequestInterceptor 
		    className="org.apache.tomcat.request.SimpleMapper" debug="0" />
        <RequestInterceptor 
		    className="org.apache.tomcat.request.SessionInterceptor" />
        <RequestInterceptor 
		    className="org.apache.tomcat.request.SecurityCheck" />
        <RequestInterceptor 
		    className="org.apache.tomcat.request.FixHeaders" />

        <!-- @@@ This connector uses port number 8007 for it's ajp communication -->
        <Connector 
		    className="org.apache.tomcat.service.SimpleTcpConnector">
            <Parameter 
                name="handler" 
                value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/>
            <Parameter name="port" value="8007"/>
        </Connector>

        <!-- @@@ the /jow context -->
        <Context path="/joe" docBase="webapps/joe" debug="0" reloadable="true" > 
        </Context>
    </ContextManager>
</Server>       
            

When looking at server_joe.xml you can see that the <Connector> is configured for port 8007. In server_bill.xml (see next) on the other hand the <Connector> is configured for port 8009.

Bill's server.xml file
    
<?xml version="1.0" encoding="ISO-8859-1"?>

<Server>
    <!-- Debug low-level events in XmlMapper startup -->
    <xmlmapper:debug level="0" />

    <!--  @@@
        Note, the log files are suffixed with _bill to distinguish
        them from the joe files. 
    -->

    <Logger name="tc_log" 
            path="logs/tomcat_bill.log"
            customOutput="yes" />

    <Logger name="servlet_log" 
            path="logs/servlet_bill.log"
            customOutput="yes" />

    <Logger name="JASPER_LOG" 
        path="logs/jasper_bill.log"
            verbosityLevel = "INFORMATION" />

    <!--  @@@
        Note, the work directory is suffixed with _bill to distinguish
        it from the joe work directory.
    -->
    <ContextManager debug="0" workDir="work_bill" >
        <!-- Context level Setup -->
        <ContextInterceptor 
		    className="org.apache.tomcat.context.AutoSetup" />
        <ContextInterceptor 
		    className="org.apache.tomcat.context.DefaultCMSetter" />
        <ContextInterceptor 
		    className="org.apache.tomcat.context.WorkDirInterceptor" />
        <ContextInterceptor 
		    className="org.apache.tomcat.context.WebXmlReader" />
        <ContextInterceptor 
		    className="org.apache.tomcat.context.LoadOnStartupInterceptor" />
        <!-- Request processing -->
        <RequestInterceptor 
		    className="org.apache.tomcat.request.SimpleMapper" debug="0" />
        <RequestInterceptor 
		    className="org.apache.tomcat.request.SessionInterceptor" />
        <RequestInterceptor 
		    className="org.apache.tomcat.request.SecurityCheck" />
        <RequestInterceptor 
		    className="org.apache.tomcat.request.FixHeaders" />

        <!-- @@@ This connector uses port number 8009 for it's ajp communication -->
        <Connector className="org.apache.tomcat.service.SimpleTcpConnector">
            <Parameter 
                name="handler" 
                value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/>
            <Parameter name="port" value="8009"/>
        </Connector>

        <!-- @@@ the /bill context -->
        <Context path="/bill" docBase="webapps/bill" debug="0" reloadable="true" > 
        </Context>
    </ContextManager>
</Server>       
          

The port configuration is not the only place where the joe and bill configuration differs. We have @@@ marks in the xml files marking the four places where changes had to be made. As you can see, this difference is necessary to avoid the two Tomcat processes from overwriting each other's logs and workspace.

Then we should start the two tomcat processes using the -f command line option:

bin/starup -f conf/server_joe.xml
bin/starup -f conf/server_bill.xml
and then access them from Apache based on the different URL path prefixes.

Configuring Virtual Hosting

It is possible to support virtual hosts under Tomcat Ver3.1, in fact the virtual host configuration is very similar to configuring for multiple JVM (as explained in the previous section) and the reason is simple; in Tomcat 3.1 each virtual host is implemented by a different Tomcat process.

With the current (Ver3.1) Tomcat, virtual hosting awareness is provided by the web server (Apache/Netscape…). The web server virtual hosting support is used by the Tomcat adapter to redirect requests belonging to a certain virtual host to the JVM(s) containing the contexts of this virtual host. This means that if (for example) we have two virtual hosts (vhost1 and vhost2), we will have two JVMs: one running the contexts of vhost1 and the other running the contexts of vhost2. These JVMs are not aware of each others existence, in fact, they are not aware of the concept of virtual hosting. All the virtual hosting logic is inside the web-server adapter. To make things clearer, lets look at the following sample Apache-Tomcat configuration file:

Apache-Tomcat Configuration with Virtual Hosts Support
    
######################################################################
#        Apache Tomcat Virtual Hosts Sample Configuration            #
######################################################################
LoadModule jserv_module modules/ApacheModuleJServ.dll
<IfModule mod_jserv.c>
ApJServManual on
ApJServDefaultProtocol ajpv12
ApJServSecretKey DISABLED
ApJServMountCopy on
ApJServLogLevel notice

ApJServDefaultHost localhost
ApJServDefaultPort 8007

# 1 Creating an Apache virtual host configuration
NameVirtualHost 9.148.16.139

# 2 Mounting the first virtual host
<VirtualHost 9.148.16.139>
ServerName www.vhost1.com
ApJServMount /examples ajpv12://localhost:8007/examples
</VirtualHost>

# 3 Mounting the second virtual host
<VirtualHost 9.148.16.139>
ServerName www.vhost2.com
ApJServMount /examples ajpv12://localhost:8009/examples
</VirtualHost>
</IfModule>
            

As can be seen, steps 1,2 and 3 define two Apache virtual hosts and for each of them, mount the /examples context to a certain ajpv12 URL. Each such ajpv12 URL points to a JVM that contains the virtual host. The configuration of the two JVMs is very similar to the one demonstrated in the previous section, we will need again to use two different server.xml files (one for each virtual host process) and we will need to start the Tomcat processes with the -f command line option. After doing that we will be able to approach Apache, each time with a different host name, and the adapter will redirect us to the appropriate JVM.

The need for improved virtual host support
Having each virtual host implemented by a different JVM is a huge scalability problem. The next versions of Tomcat will make it possible to support several virtual hosts within the same Tomcat JVM.

Credits

This document was created by Gal Shachor. It was split off into a separate document and revised by Alex Chaffee and Rob Slifka.

    With help from (in alphabetical order):
    • Jonathan Bnayahu
      Alex Chaffee
      Fiona Czuczman
      Costin Manolache
      Rob Slifka

    Copyright ©1999-2001 The Apache Software Foundation
    Legal Stuff They Make Us Say
    Contact Information

    Springer期刊LaTeX模板中参考文献格式选择与编译错误的快速修复指南 本文针对Springer期刊LaTeX模板中参考文献编译后显示问号的常见问题,提供了快速修复指南。核心在于正确选择并配置与期刊匹配的参考文献格式文件(.bst),并执行标准的四步编译流程。文章详细解释了问题根源,并给出了从查找正确.bst文件到修改代码、执行编译的完整解决方案,帮助作者高效解决投稿中的技术障碍。 阅读详情

    相关推荐

    09、Flutter FFI Dart Native API

    本文介绍了 Dart Native API 的基本用法,解决了 Dart 与 C 异步通讯的问题

    eieihihi的专栏 4397

    漏洞扫描常见修复方案

    1、Apache JServ protocol service 描述: 问题出在Tomcat的8009端口,错误的提示是8009端口上运行着tcp协议。 修复方案: 解决办法: 只能是通过关闭8009端口来实现 Apache JServ protocol = AJP 解决方案:修改tomcat 的service.xml配置文件 将 <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> 这一行注释掉 2、Slow

    CVJASBPTR的博客 2519

    6.2 磁悬浮轴承:软件架构与实现

    本文系统阐述了磁悬浮轴承控制系统的软件架构与实现方法。采用分层架构设计,包括硬件抽象层、实时控制内核、控制算法层和应用层,确保系统实时性和可靠性。重点分析了电流环、位置环等关键控制任务的调度策略,比较了不同硬件平台(DSP、ARM、FPGA)的软件实现方案。强调模块化设计、配置化管理等工程实践,并详细介绍了从算法仿真到系统联调的完整开发流程。最后指出严格的测试验证是保证系统性能的关键,需通过多阶段测试评估起浮时间、稳态精度等核心指标。

    技术工作者 751

    [渗透]Apache Tomcat示例目录漏洞

    漏洞等级:中 Apache Tomcat默认安装包含"/examples"目录,该目录包含许多示例servlet和JSP。其中一些示例存在安全风险,不应部署在生产服务器上。 http://localhost:8080/examples/servlets/servlet/SessionExample 示例允许会话操作。因为会话是全局的,所以这个示例会带来很大的安全风险,因为攻击者可用通过操纵其会话来...

    胖胖的ALEX 4万+

    大模型训练(1):流水线并行

    Gpipe的方法是,在训练时计算和运用的是micro-batch里的均值和方差,但同时持续追踪全部mini-batch的移动平均和方差,以便在测试阶段进行使用。流水线并行的核心思想是:在模型并行的基础上,进一步引入数据并行的办法,即把原先的数据再划分成若干个更小的batch,分批送入GPU进行训练,算一部分就让下一个GPU动起来。从实验结果可知,在关掉NVlinks的情况下,Gpipe一样也能实现随着GPU数量的增加,训练速度也增加的效果。前文说过,随着模型的增加,每块GPU中存储的中间结果也会越大。

    呆呆象呆呆的博客 1968

    Unreal5 从入门到精通之 学习Niagara特效系统

    UE5 Niagara粒子系统解析 Niagara是UE5中的高性能粒子特效系统,相比传统粒子系统具有完全可编程性和可视化节点编辑两大特点。核心单元发射器(Emitter)分为模板发射器(预设效果如喷泉、火焰)和空白发射器(高度自定义)。系统提供13种预设模板,包括吹飞粒子、五彩纸屑爆发、动态光束等常见特效。 Niagara采用三级模块化设计: 系统级:全局参数设置与更新 发射器级:控制粒子生成规则与行为 粒子级:处理单个粒子的生命周期和渲染 关键模块包括初始化粒子属性、物理模拟、颜色渐变等,支持GPU加速

    TxNet 1120

    Apache Tomcat配置教程

    其实很多博主已经发了Tomcat的配置教程,至于我为什么也发表呢,一方面是帮助自己记录一下我的电脑是如何配置的;另一方面是很多博主的配置教程于我的电脑而言,行不通.因此借机发表一下我的配置方案.

    qq_36155477的博客 593

    基于STM32+RFID设计的宿舍检修管理系统

    设计一个上位机,用来管理查看维修检修信息,当维修寝室的设备或者检修完成时,通过STM32上的RC522刷一下这个寝室的IC卡,识别这是哪个寝室,识别成功后在软件上弹出一个对话框,填写本次维修或者检修的事件,填写完毕点击提交即可。...

    2555

    Apache+Tomcat集群配置 上传图片

    一、 技术基础 Apache和Tomcat同是Apache基金会下面的两个项目。一个是HTTP WEB服务器,另一个是servlet容器(servlet container),最新的5.5.X系列实现Servlet 2.4/JSP 2.0Spec,一般也可以把Tomcat看做是应用服务器。 Apache是目前比较受欢迎的网站服务器软件,它不但功能强大,而且完全免费,并且支持市场上流行的各种

    yuebaoling890611的专栏 2149

    新手秒变高手:使用一键脚本快速安装OpenClaw并完成初始化配置

    一键脚本是一种自动化工具,可以帮助用户快速完成软件的安装和配置过程,无需手动执行繁琐的命令。OpenClaw提供了官方的一键安装脚本,让新手用户也能轻松部署OpenClaw。

    一键难忘的博客 358

    基于形状的模板匹配之候选点选择

    基于形状的匹配匹配,顶层金字塔提取候选点

    manuoo的专栏 2767

    Tomcat-Apache HOWTO Tomcat+Apache HOWTO (转)

    Tomcat-Apache HOWTO Tomcat+Apache HOWTO (转)[@more@] apache.org/index.html"> tomcat - Meow!" border=0 heigh...

    csd3176的博客 334

    利用Python实现Springer文献关键词爬虫

    🔧 如何分析Springer的搜索结果HTML结构🕷️ 编写高性能异步爬虫抓取论文元数据📊 使用Pandas导出Excel🧠 如何处理作者、摘要、DOI等字段🔄 如何优化爬虫稳定性与可扩展性。

    2201_76125261的博客 414

    The Apache 和Tomcat Connector 连接 快速指导 - Generic HowTo

     The Apache 和Tomcat Connector 连接 快速指导 - Generic HowTo   Tomcat与HTTP服务器集成的原理    Tomcat服务器通过Connector连接器组件与客户程序建立连接,Connector组件负责接收客户的请求,以及把Tomcat服务器的响应结果发送给客户。默认情况下,Tomcat在server.xml中配置了两种连接器:     

    jiayue's BLOG 3836

    深度学习工具包 DeepLearningToolbox

    深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

    WINCC7.3破解文件

    WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

    http://wiki.apache.org/tomcat/HowTo

    http://wiki.apache.org/tomcat/HowTo Contents Meta How do I add a question to this page? How do I contribute to Tomcat's documentation? Installation How do I set up and run Tomcat on Maci...

    weixin_33807284的博客 1276

    计算机控制技术及应用

    《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

    tomcat9整合IIS,官网资料

    链接:https://tomcat.apache.org/connectors-doc/webserver_howto/iis.html翻译就不翻译的了,反正按照这个一步步来,是最靠谱的

    beautifulblue的博客 403

    假人有限元模型

    假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

    The Apache Tomcat Connector

    参考:http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html 参考:http://bbs.linuxtone.org/thread-1195-1-1.html 参考:http://tomcat.apache.org/connectors-doc/

    hjwang1的专栏 557

    Apache与Tomcat集群配置(2)

    三、 集群配置 集群除了负载均衡,另一个主要功能是Session Replication。 打开tomcat1\conf\ server.xml将&lt;Cluster&gt;部分的注释去掉。 再打开tomcat2\conf\ server.xml将&lt;Cluster&gt;部分的注释也去掉,并将&lt;Cluster&gt;中&lt;Receiver&gt;的tcpListenPo...

    行动起来 175

    HOWTO:在 Tomcat 中禁用 HTTP 方法

    在安全相关扫描中出现的一个常见项目是网站或Web应用程序中允许的HTTP方法。对于我们这些使用ApacheTomcat而不是像Apache或IIS这样的前端Web服务器来运行我们的网站的人来说,很好地理解安全约束是如何工作的将是至关重要的。安全约束虽然不如ApacheWeb服务器中的那些完整,但却是保护Web应用程序的一种非常有用的方法。本HOWTO专注于在指定的URI上禁用HTTP方法,但您可以在安全约束方面做更多事情,未来的文章将介绍这些内容。...

    allway2的博客 2198

    Apache Tomcat 6.0 SSL Configuration HOW-TO

    http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html

    497

    Apache Tomcat 9 用户指南

    Apache Tomcat 9  Apache Tomcat9 版本9.0.14, 2018年12月6日 这是Apache Tomcat Servlet / JSP容器的文档包的顶级入口点 。的Apache Tomcat 9.0版本实现了Servlet 4.0和JavaServer Pages 2.3 规范从 Java社区进程,并包含许多额外的功能,使开发和部署Web应用程序和Web服务的有用...

    YunWisdom 4931

    HOWTO: Configure Access Logging in Tomcat

    【代码】HOWTO: Configure Access Logging in Tomcat。

    allway2的博客 509

    HOWTO:在 Tomcat 中抑制服务器身份

    如果您部署一个名为“newapp”的应用程序,那么任何发送到/newapp的错误请求都需要使用该应用程序的web.xml中定义的自定义错误进行处理。这些细节引发的担忧是,攻击者掌握的有关您的Web应用程序或应用服务器的信息越多,攻击者就越容易想出破坏服务的方法。使用将webapp部署到TomcatROOT上下文中的配置并假设您已经开发了自定义错误500和404页面,您可以将以下内容添加到您的ROOTWeb应用程序的web.xml配置中,该配置通常位于。...

    allway2的博客 483

    Tomcat 5.5-Manager App HOW-TO(翻译了部份,努力中...)

    偶也是学习,不过,觉得每次都是读英文,麻烦,就希望把它翻译成中文,为自己,也为其它想学习的朋友,呵呵.不过,由于内容比较多,可能翻译的时间要多一点,如果有兴趣合作的朋友,可以回复BLOG,留言您想翻译那一段.让我们一起完成该内容.不过,为了增加文档的可阅读性,把阅读当成一种享受,请在翻译的时候遵守以下几点:1).翻译的字体一律用绿色.保证阅读不那么伤眼睛.2).重点标题用红色标明,重点内容用蓝色标

    冯立彬的博客 9701

    apache-2.0.43和tomcat-4.1.12集成

    Apache 2.0.48 / Tomcat 4.1.29 / mod_jk for Windows XP Prolast update: 12/13/2003Building an Apache HTTP + Tomcat environment is five major steps:install JDKinstall Apacheinstall Tomcatinst

    anperl's column 3295
    上一篇: Java里的高级图象处理
    下一篇: OPENGL(14) c++曲面构造 网格线
    hem
    hem
    博客等级 码龄26年 19粉丝 287原创
    评论
    成就一亿技术人!
    拼手气红包6.0元
    还能输入1000个字符
     
     条评论被折叠 查看
    添加红包

    请填写红包祝福语或标题

    个

    红包个数最小为10个

    元

    红包金额最低5元

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

    抵扣说明:

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

    余额充值