Tomcat搭建本地文件服务,抛弃某蒲公英发布测试版本
最近由于某蒲公英加入了审核机制,导致发布内测版app存在各种困扰,故而准备搭建一个本地文件服务系统,便于用于测试软件的发布。
1.在conf/server.xml中配置Tomcat用于访问的目录和路径
...
<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" />
<Context path="/app" docBase="F:/tomcat_file" debug="0" reloadable="true" />
</Host>
</Engine>
</Service>
</Server>
2.修改web.xml中的servlet
配置,将下面的listings
的值改为true
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
3.防止中文名称乱码,在Connector
中加上URIEncoding="utf-8"
<Connector URIEncoding="utf-8" port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
启动Tomcat,访问http://192.168.31.212:8080/app/就可以看到了
来源:CSDN
作者:big_sea_m
链接:https://blog.csdn.net/big_sea_m/article/details/103751165