配置Tomcat 輸入ip直接訪問自己的頁面

  1. 找到tomcat下的conf文件下service.xml配置文件
  2. 修改端口號爲80
    <Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8453" URIEncoding="UTF-8" />
  1. 找到<host></host>結點,在節點中加入
<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>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章