一、进入tomcat7/conf目录,找到server.xml文件编辑
- vi /home/java/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地址后,就可以直接通过域名访问。
Linux tomcat部署War包,Linux在Tomcat部署JavaWeb项目,Linux部署War包
http://fanshuyao.iteye.com/blog/2360423
Linux下Tomcat修改favicon.ico图标
http://fanshuyao.iteye.com/blog/2359800
Linux tomcat设置ip地址直接访问
http://fanshuyao.iteye.com/blog/2359793
Linux Tomcat安装,Linux配置Tomcat,Linux Tomcat修改内存,Linux tomcat修改端
http://fanshuyao.iteye.com/blog/2359706
Linux下载jdk
http://fanshuyao.iteye.com/blog/2302566
Linux安装Jdk,CentOS安装Jdk
http://fanshuyao.iteye.com/blog/2302562