例如 我的正常的工程路径如下 http://127.0.0.1:8080/web/ 这样的路径才可以访问工程现在我想 http://127.0.0.1 这样就可以访问上面的工程 应该怎么处理?
我记得apache 代理功能,但是apache的代理好像只能够不显示端口。请教。。 最好能写好详细步骤。 谢谢
我记得apache 代理功能,但是apache的代理好像只能够不显示端口。请教。。 最好能写好详细步骤。 谢谢
1.去掉端口号:
在server.xml中把Http端口改成80,因为浏览器默认使用80端口,如:<Connector connectionTimeout="20000" port="80" protocol="HTTP/1.1" redirectPort="8443"/>
2.去掉工程名:
在server.xml中加入如下context设置(假设你的Tomcat在C:\Java\apache-tomcat-6.0.18,工程名为test):
<Context docBase="C:\Java\apache-tomcat-6.0.18\webapps\test" path="" reloadable="true" /></Host>
其中的docBase为找到工程的路径,path就是你的工程context,这里什么也不写。如果你写成"hello",那么此时你的访问路径就是:http://localhost/hello,这里什么也没写,所以访问路径是:http://localhost
看看这些行不行
然后在tomcat 的web.xml
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
里面的东西修改成/web/..的路径(试试,也可能是在别的地方 呵呵)
<Context docBase="C:\Java\apache-tomcat-6.0.18\webapps\test" path="" reloadable="true" />
学习。。
把path 路径改成/web再者,你可以用跳转的方式实现啊。
先在tomcat 的web.xml
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
在index.html 里面用js 跳转到http://localhost:8080/web/