Tomcat index.html空白页面404

时间:2014-09-07 14:17:09

标签: tomcat

http://localhost:8080/正确返回正常的tomcat管理页面。

我的主人档案:

  

127.0.0.1 api

http://api:8080/index.html获取一个空白页面(firebug报告404)

我将应用程序放在一个单独的位置:/ html / API / API

我将此添加到server.xnl

  <Host name="api"  
        unpackWARs="true" autoDeploy="true"
        appBase="/html/API/API/web" >
  </Host>

我的web.xml是:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
</web-app>

index.html的路径是:/html/API/API/web/index.html

我在Netbeans中设置了它,如果这有所不同。

我似乎无法摆脱这个空白页并正确显示index.html

编辑: 这工作:

  <Host name="api"  
        unpackWARs="true" autoDeploy="true"
        appBase="/html/API/API/dist" >
       <Context path="/" docBase="/html/API/API/build/web" reloadable="true">
       </Context>
  </Host>

1 个答案:

答案 0 :(得分:1)

主机的appBase是Tomcat查找此虚拟主机可用的所有Web应用程序的位置。因此,对于您的api虚拟主机,它等同于webapps目录。因此,您应该将war文件或爆炸的war文件放在此目录中,而不是index.html。

如果您希望从根上下文提供此虚拟主机的单个应用程序,则将其命名为ROOT.war(如果部署爆炸的war文件,则将其命名为ROOT):

/html/API/API/web/ROOT/index.html

有关详细信息,请参阅http://tomcat.apache.org/tomcat-7.0-doc/config/host.html

相关问题