我试图将我的应用程序文件部署到Tomcat 7。我已经成功部署了它们,但我只能在 http://example.com:8080/myproject/index 下看到我的文件。(假设我的项目文件夹myproject
,我的域example.com
。
我想像这样访问我的域:http://example.com/index。
我该怎么做?
ok我已经解决了这个问题。
在默认服务器中.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 "%r" %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" />
现在它可以工作:)