正常的请求一个项目的路径是:http://ip地址:端口号/项目名。

设置tomcat下conf文件下的server.xml配置文件实现只请求ip地址来访问项目

  • 1 找到server.xml配置文件并打开,在大概文件末尾的位置找到如下形式的代码:
      <Host name="localhost" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">

<!--填写处-->
  • 在上面填写处的地方填写下面的代码:
<Context path="" docBase="/home/webuser/tomcat5.5.28/webapps/xiangmu" debug="0" reloadable="true"/>
  •   最后将8080端口指向80端口请求
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

重启tomcat之后在web地址栏输入:ip地址    即可

相关文章:

  • 2021-08-29
  • 2021-12-10
  • 2021-04-03
  • 2022-01-18
  • 2021-05-01
  • 2021-12-05
  • 2021-06-09
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案