【问题标题】:Deploying Java application to Tomcat root directory in Digitalocean [duplicate]将Java应用程序部署到Digitalocean中的Tomcat根目录[重复]
【发布时间】:2015-02-11 12:58:25
【问题描述】:

我尝试将我的应用程序文件部署到 Tomcat 7。我已成功部署它们,但我只能在 http://example.com:8080/myproject/index 下看到我的文件。 (假设我的项目文件夹是myproject,我的域是example.com。)

我想像这样访问我的域:http://example.com/index

我该怎么做?

【问题讨论】:

    标签: java tomcat7 digital-ocean


    【解决方案1】:

    好的 我已经解决了这个问题。

    在默认的 server.xml 文件标签中像这样,

    <Host name="localhost" appBase="webapps"
         unpackWARs="true" autoDeploy="true">
    
        <!-- SingleSignOn valve, share authentication between web applications
         Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->
    
        <!-- Access log processes all example.
         Documentation at: /docs/config/valve.html
         Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
           prefix="localhost_access_log." suffix=".txt"
           pattern="%h %l %u %t &quot;%r&quot; %s %b" />
    
    
      </Host>
    

    但我已将其删除并更改为这些

    <Host appBase="webapps" name="example.com" unPackWars="true" autoDeploy="true">             
        <Context path="" docBase="myproject" debug="0" reloadable="true"/>
      </Host>
      <Host appBase="webapps" name="www.example.com" unPackWars="true" autoDeploy="true">            
        <Context path="" docBase="myproject" debug="0" reloadable="true"/>
      </Host>
    

    比我变了

    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    

    喜欢这个

    <Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    

    现在可以了:)

    【讨论】:

      猜你喜欢
      • 2011-07-16
      • 1970-01-01
      • 2010-11-29
      • 1970-01-01
      • 2018-07-14
      • 2018-10-31
      • 2016-07-22
      相关资源
      最近更新 更多