1.打开Tomcat的默认安装路径下的Service.xml文件

路径:C:\Program Files\Apache Software Foundation\Tomcat 8.0\conf\Server.xml

2.修改配置文件

<?xml version='1.0' encoding='utf-8'?>
<!--Licensed to the Apache Software Foundation (ASF) under one or morecontributor license agreements.  See the NOTICE file distributed withthis work for additional information regarding copyright ownership.The ASF licenses this file to You under the Apache License, Version 2.0(the "License"); you may not use this file except in compliance withthe License.  You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may notdefine subcomponents such as "Valves" at this level.Documentation at /docs/config/server.html-->
<Server port="8005" shutdown="SHUTDOWN"><Listener className="org.apache.catalina.startup.VersionLoggerListener" /><!-- Security listener. Documentation at /docs/config/listeners.html<Listener className="org.apache.catalina.security.SecurityListener" />--><!--APR library loader. Documentation at /docs/apr.html --><Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /><!-- Prevent memory leaks due to use of particular java/javax APIs--><Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /><Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /><Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /><!-- Global JNDI resourcesDocumentation at /docs/jndi-resources-howto.html--><GlobalNamingResources><!-- Editable user database that can also be used byUserDatabaseRealm to authenticate users--><Resource name="UserDatabase" auth="Container"type="org.apache.catalina.UserDatabase"description="User database that can be updated and saved"factory="org.apache.catalina.users.MemoryUserDatabaseFactory"pathname="conf/tomcat-users.xml" /></GlobalNamingResources><!-- A "Service" is a collection of one or more "Connectors" that sharea single "Container" Note:  A "Service" is not itself a "Container",so you may not define subcomponents such as "Valves" at this level.Documentation at /docs/config/service.html--><Service name="Catalina"><!--The connectors can use a shared executor, you can define one or more named thread pools--><!--<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"maxThreads="150" minSpareThreads="4"/>--><!-- A "Connector" represents an endpoint by which requests are receivedand responses are returned. Documentation at :Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)Java AJP  Connector: /docs/config/ajp.htmlAPR (HTTP/AJP) Connector: /docs/apr.htmlDefine a non-SSL/TLS HTTP/1.1 Connector on port 8080-->  <!-- 改为80端口 --><Connector port="80" protocol="HTTP/1.1"connectionTimeout="2000"redirectPort="8443" /><!-- A "Connector" using the shared thread pool--><!--<Connector executor="tomcatThreadPool"port="8080" protocol="HTTP/1.1"connectionTimeout="20000"redirectPort="8443" />--><!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443This connector uses the NIO implementation that requires the JSSEstyle configuration. When using the APR/native implementation, theOpenSSL style configuration is required as described in the APR/nativedocumentation --><!--<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"maxThreads="150" SSLEnabled="true" scheme="https" secure="true"clientAuth="false" sslProtocol="TLS" />--><!-- Define an AJP 1.3 Connector on port 8009 --><Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /><!-- An Engine represents the entry point (within Catalina) that processesevery request.  The Engine implementation for Tomcat stand aloneanalyzes the HTTP headers included with the request, and passes themon to the appropriate Host (virtual host).Documentation at /docs/config/engine.html --><!-- You should set jvmRoute to support load-balancing via AJP ie :<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">-->   <!-- 修改为域名,如:www.baidu.com --><Engine name="Catalina" defaultHost="域名"><!--For clustering, please take a look at documentation at:/docs/cluster-howto.html  (simple how to)/docs/config/cluster.html (reference documentation) --><!--<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>--><!-- Use the LockOutRealm to prevent attempts to guess user passwordsvia a brute-force attack --><Realm className="org.apache.catalina.realm.LockOutRealm"><!-- This Realm uses the UserDatabase configured in the global JNDIresources under the key "UserDatabase".  Any editsthat are performed against this UserDatabase are immediatelyavailable for use by the Realm.  --><Realm className="org.apache.catalina.realm.UserDatabaseRealm"resourceName="UserDatabase"/></Realm><Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true"><!-- SingleSignOn valve, share authentication between web applicationsDocumentation at: /docs/config/valve.html --><!--<Valve className="org.apache.catalina.authenticator.SingleSignOn" />--><!-- Access log processes all example.Documentation at: /docs/config/valve.htmlNote: 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 &quot;%r&quot; %s %b" /></Host>

    <!-- 新增一个Host --><Host name="域名"  appBase="webapps" unpackWARs="true" autoDeploy="true"><Context path="/" docBase="C:/Program Files/Apache Software Foundation/Tomcat 8.0/webapps/网站的文件夹名称" /> </Host></Engine></Service>
</Server>

3.保存,再重启Tomcat就可以了

注意:服务器IP地址得绑定域名的前提下才有效

转载于:https://www.cnblogs.com/tianhengblogs/p/9332764.html

Tomcat------如何配置域名和80端口相关推荐

  1. 一键去除域名非80端口,去掉域名后面带的端口号快速解决方案

    一键去除域名非80端口,去掉域名后面带的端口号快速解决方案 参考文章: (1)一键去除域名非80端口,去掉域名后面带的端口号快速解决方案 (2)https://www.cnblogs.com/phpw ...

  2. linux防火墙配置80端口,Linux配置防火墙 开启80端口

    Linux配置防火墙 开启80端口的方法 命令行输入: vi /etc/sysconfig/iptables 将 -A INPUT -m state --state NEW -m tcp -p tcp ...

  3. Nginx——安装与虚拟主机配置(域名非80端口问题)

    一.引言 因为甲方提出问题:一个服务器与IP,两个域名a.b分别对应两个要部署的网站,这个一般是一个域名a对应一个主机服务器ip的默认80端口,另外的网站只能用其他端口(如b:8080对应主机ip:8 ...

  4. tomcat报404 原因是80端口被占用及解决办法

    项目配置:"JDK1.7+tomcat7.0+MYSQL+windows server2012 64bit" 今天客户服务器由于客户自己想装SQLserver 和 Visual s ...

  5. nginx-1.14.0配置文件 配置域名转发到端口

    liunx卸载nginx 执行 yum remove nginx搜索 find / -name 'nginx'rm -rf 删除nginx相关目录 安装nginx 1:首先我们需要下载nginx: w ...

  6. Nginx配置中的80端口

    server {listen 80;//浏览器默认端口server_name aa.bb.cn;//#提供服务的域名主机号location /tt/ {proxy_pass http://localh ...

  7. linux防火墙 3306端口,Linux配置防火墙 开启80端口、3306端口的方法

    1.编辑防火墙过滤设置 vi /etc/sysconfig/iptables -A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEP ...

  8. Linux配置防火墙 开启80端口的方法

    更多请支持:http://www.webyang.net/Html/web/article_173.html 在虚拟机里装了nginx+mysql+php,虚拟机里的桌面可以访问, netstat - ...

  9. nginx配置域名,不要端口

    版权声明:本文为博主转载文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/panshoujia/article/d ...

  10. 把tomcat的8080改为80端口

    找到配置文件:tomcat/conf/server.xml 打到文件里的: Define a non-SSL HTTP/1.1 Connector on port 8080     -->    ...

最新文章

  1. 卷积神经网络CNN---权值共享
  2. SAP EWM - 包装主数据 - 包装明细 -2
  3. 使用POI导出百万级数据到excel的解决方案
  4. jvm中有哪些内存区域会发生内存溢出
  5. SQLi-LABS(1~10关详解)
  6. 服务器t4卡在哪个位置,英特尔(Intel )X710-T4融合网络适配器4口万兆X710T4服务器网卡...
  7. 获取指定日期所属年份的第一天日期或最后一天日期
  8. 隹悦服务器批量控制软件
  9. 2017年单多晶市场竞争核心分析
  10. hdu1556 Color the ball
  11. 多数元素(哈希表和投票法)
  12. 程序员爱穿格子衫、秃头的刻板印象是如何形成的?
  13. android 调用短信,Android实现接收短信和发送短信功能
  14. 每周一荐:《盗梦空间》《不能承受的生命之轻》
  15. 一个指针占几个字节?原理是什么呢?
  16. 《REWORK》启示录一夜成名只是传说——创业一步步来
  17. 【PE】PE文件结构学习
  18. python界面教学视频_tkinter 窗口可视化你的 Python程序GUI教学
  19. findfont: Font family [‘Times New Roman‘] not found. Falling back to DejaVu Sans.字体安装
  20. 心累,网站被盗刷 1.7T 流量

热门文章

  1. javscript 简单拖拽(drag)拖放事件、dataTransfer详解,垃圾桶效果
  2. 数组异或交换出现的问题
  3. Centos7.x 安装Kubernetes(K8s) 1.16.2 kubeadm kubelet kubectl 单机版 2019-10-20更新
  4. 手机等第三方终端访问 WebStorm 页面
  5. @TableField注解使用(忽略扫描)
  6. 阶段1 语言基础+高级_1-3-Java语言高级_06-File类与IO流_07 缓冲流_4_缓冲流的效率测试_复制文件...
  7. Javascript定位表单控件的几种方式
  8. shell截取字符串的方法
  9. 2013年12月24号感受
  10. iview(DatePicker)时间转入后台少一天 解决方案