试验环境:
- centos 7
- jdk1.8
- tomcat8.5
index.html
<!DCOTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>hello word</title>
</head>
<body>
<p>这是一个网站</p>
</body>
</html>
在tomcat中/conf目录下找到server.xml
在下上添加如下内容
<Host name="192.168.1.95" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="spider" debug="0" reloadable="true" crossContext="true"/>
<Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="tot_log." suffix=".txt" timestamp="true"/>
</Host>
其中Host name="ip地址“ docBase=“放在webapps目录下的html文件的文件夹名” 即 \webapps\spider\xxx.html
配置好后,把有html的文件夹放在tomcat的webapps目录下新建一个spider文件夹(appBase=“webapps”)
访问url http://185.27.51.15:8098/xxx.html 即可