Linux tomcat设置ip地址直接访问,tomcat设置ip地址直接访问,tomcat绑定ip地址
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
©Copyright 蕃薯耀 2017年3月2日
http://www.cnblogs.com/fanshuyao/
一、进入tomcat7/conf目录,找到server.xml文件
二、修改端口,把tomcat默认的8080端口修改成80端口,这样访问就不需要加上端口号
即把
- <Connector port="8080" protocol="HTTP/1.1"
- connectionTimeout="20000"
- redirectPort="8443" />
修改为:
- <Connector port="80" protocol="HTTP/1.1"
- connectionTimeout="20000"
- redirectPort="8443" />
在Linux上直接修改Tomcat端口参考:
http://fanshuyao.iteye.com/blog/2359706
三、在server.xml文件最下边找到Host节点
- <Host name="localhost" appBase="webapps"
- unpackWARs="true" autoDeploy="true">
- <!-- SingleSignOn valve, share authentication between web applications
- Documentation at: /docs/config/valve.html -->
- <!--
- <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
- -->
- <!-- Access log processes all example.
- Documentation at: /docs/config/valve.html
- Note: The pattern used is equivalent to using pattern="common" -->
- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
- prefix="localhost_access_log." suffix=".txt"
- pattern="%h %l %u %t "%r" %s %b" />
- </Host>
在Host节点里面最下边加上Web项目映射地址的配置,即把要访问的Web项目的访问地址做一个路径映射,而path设置为空:
- <Context path="" docBase="/home/java/tomcat7/webapps/finance" debug="0" reloadable="true"/>
完整示例:
- <Host name="localhost" appBase="webapps"
- unpackWARs="true" autoDeploy="true">
- <!-- SingleSignOn valve, share authentication between web applications
- Documentation at: /docs/config/valve.html -->
- <!--
- <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
- -->
- <!-- Access log processes all example.
- Documentation at: /docs/config/valve.html
- Note: The pattern used is equivalent to using pattern="common" -->
- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
- prefix="localhost_access_log." suffix=".txt"
- pattern="%h %l %u %t "%r" %s %b" />
- <Context path="" docBase="/home/java/tomcat7/webapps/finance" debug="0" reloadable="true"/>
- </Host>
四、域名绑定
域名绑定需要在域名管理中心设置,把域名绑定访问的ip地址后,就可以直接通过域名访问。
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
©Copyright 蕃薯耀 2017年3月2日
http://www.cnblogs.com/fanshuyao/