前景:将tomcat部署到服务器上,局域网其他电脑通过IP地址访问该服务器上部署的项目(比如:网站)。
解决方案:首先将服务器的ip地址设置为静态的(通过网上邻居,比如:192.168.1.100),然后在tomcat\conf目录下,将server.xml打开,修改一下内容:
将:
<Host name="localhost" appBase="webapps"
unpackWARs="true"
xmlValidation="false" xmlNamespaceAware="false">
改为:
<Host name="192.168.1.100" appBase="webapps"
unpackWARs="true"
xmlValidation="false" xmlNamespaceAware="false">
将:
<Host name="localhost" appBase="webapps"
unpackWARs="true"
xmlValidation="false" xmlNamespaceAware="false">
改为:
<Host name="192.168.1.100" appBase="webapps"
unpackWARs="true"
xmlValidation="false" xmlNamespaceAware="false">