Tomcat configuration help: multiple ports not responding

后端 未结 2 1460
清酒与你
清酒与你 2021-01-05 11:21

My goal is to have port 80 and 81 listen and serve content from two distinct paths. I\'m looking at replicating what I used to do with IIS and creating websites on specific

相关标签:
2条回答
  • 2021-01-05 12:17

    This is working for me:

    <Service name="Stable">
        <Connector 
            port="80" 
            protocol="HTTP/1.1"                
            connectionTimeout="20000" />
    
        <Engine name="Stable" defaultHost="localhost">
            <Host 
                name="localhost"  
                appBase="C:\websites\test\stable\">
    
                <Context docBase="C:\websites\test\stable\" path="" />              
            </Host>
        </Engine>
    

    0 讨论(0)
  • 2021-01-05 12:19

    I think you're on the right track, but you're just missing some of the child elements that are listed in the specification for the Service element.

    I think you're just forgetting the Engine and Host elements, which are grandparent and parent respectively to the Context element.

    <Service name="stable">
    
         <Connector port="80" protocol="HTTP/1.1" 
               maxThreads="150" connectionTimeout="20000"/>
    
         <Engine name="stable" defaultHost="localhost">
             <Host name="localhost1" appBase="webapp1">
                 <Context docBase="C:\websites\test\stable\" />
            </Host>
         </Engine>
    
    </Service>
    
    
    <Service name="release">
    
        <Connector port="81" protocol="HTTP/1.1" 
               maxThreads="150" connectionTimeout="20000"/>
    
        <Engine name="release" defaultHost="localhost2">
             <Host name="localhost2" appBase="webapp2">
                 <Context docBase="C:\websites\test\release\" />
             </Host>
         </Engine>
    
    </Service>
    

    For more information and a more detailed example, which defines two Service elements, one on port 8080 and one on port 9080, see this mailing list post:

    http://www.mail-archive.com/users@tomcat.apache.org/msg44729.html

    0 讨论(0)
提交回复
热议问题