配置Tomcat 输入ip直接访问自己的页面

  1. 找到tomcat下的conf文件下service.xml配置文件
  2. 修改端口号为80
    <Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8453" URIEncoding="UTF-8" />
  1. 找到结点,在节点中加入
<Context path="" docBase="/usr/local/tomcat/apache-tomcat-7.0.85/webapps/bos" debug="0" reloadable="true" /> 

docBase修改成项目的路径,推荐绝对路径
4. 找到自己项目中的在web.xml,配置

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>

5.在WEB-INF上加上一个页面,文件名是index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script type="text/javascript">
    window.location="/index";//写上直接访问页面的路径
</script>
<body>

</body>
</html>

猜你喜欢

转载自blog.csdn.net/weixin_36910300/article/details/79759426
今日推荐