怎么修改tomcat服务器的默认的8080端口

如题所述

Tomcat服务器安装的时候默认的端口设置是8080,通常我一看到端口是8080的网站,我就猜测服务器估计是Tomcat,一般来说网站的端口普遍
是80,apache服务器的默认端口就是80,而80与8080端口有一点区别就是,如果你去访问80端口的网站,那么可以直接输入域名访问,而没必要
带上80,因为80是http协议的默认端口;但是,如果是访问8080端口的网站,那么在输入域名以后还要加上8080才行。就是因为这个繁琐的操作,
所以我每次都会修改下端口,修改方法可以参考下面:

(1)首先找到tomcat的安装路径,找到路径conf文件夹下面的server.xml文件,如下图1所示。

图1:server.xml所在路径

(2)用文本编辑器打开server.xml,修改其中端口,文件中端口有很多,比如8005,8080,8009等等,别的都可以不用管,视情况修改就好,我只修改了8080端口为80,直接查找8080替换成80就OK了,修改后的文件内容如下:

<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this 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 with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed 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 and
limitations under the License.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN">
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm 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 share
a 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 received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
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 HTTP/1.1 Connector on port 8443
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation -->
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" 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 processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on 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">
-->
<Engine name="Catalina" defaultHost="localhost">
<!--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"/>
-->
<!-- The request dumper valve dumps useful debugging information about
the request and response data received and sent by Tomcat.
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-->
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<!-- 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 -->
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
-->
</Host>
</Engine>
</Service>
</Server>

(3)修改server.xml文件以后,重启tomcat服务器,配置修改成功。
温馨提示:内容为网友见解,仅供参考
无其他回答

tomcat默认端口号是多少?怎样修改端口?
打开"server.xml"文件,您将看到一系列配置参数,其中有一个端口号设置,其默认值为8080。如果您希望将Tomcat的端口号改为80,只需找到这一行,将其8080修改为80即可。修改完成后,为了使更改生效,需要重启Tomcat服务器。完成上述步骤后,您可以通过输入localhost:80直接访问Tomcat的主页,无需输入8080端...

tomcat怎么修改端口
打开Tomcat的安装目录,进入子目录conf 找到【conf】目录下的【server.xml】打开server.xml 修改Shutdown端口 PS:默认端口号为8005 修改访问端口 PS:默认端口号为8080 修改8009端口,将8009改为没有占用的端口号即可 重新启动Tomcat,并输入【http:\/\/localhost:【访问端口号】\/】进行测试 ...

eclipse怎么改默认端口号8080呢??
1、首先在Eclipse中点击 Windows —— Show View ——Servers。2、然后就会在Eclipse的下方显示一个Servers的栏目。3、如果没有新建Servers的话,是如下的图片,点击这个文字部分。4、然后弹出这个选项,选择Tomcat的版本。5、然后添加相应的项目。6、添加之后,再鼠标左键双击这个Tomcat v8.5 Server at ...

如何修改Tomcat服务器Server Locations
8080是Tomcat服务器的默认的端口号。我们可以通过修改Tomcat服务器的conf目 录下的主配置文件server.xml来更改.用记事本打开server.xml文件,找到如下部分: 以下为引用的内容: 将其中的port="8080"更改为新的端口号即可,如将“8080”改为“9080”等.

当装了两个tomcat后,如何修改tomcat端口(...
connectionTimeout="20000"disableUploadTimeout="true" \/>等等;最后:将port="8080"改为其它的就可以了。如port="8081"等。保存server.xml文件,重新启动Tomcat服务器,Tomcat就可以使用8081端口了。注意,有的时候要使用两个tomcat源码天空,那么就需要修改其中的一个的端口号才能使得两个同时工作。

apache-tomcat 8080端口怎么修改成80端口?
首先,找到你的安装目录,如图:打开server.xml文件,找到8080,如图:将 8080 改成你想要的端口,如 80 即可。改完后,记得要重启tomcat!将端口改成 80 后,访问就不需要输入端口了,因为默认端口就是 80。

如何修改http:\/\/域名:8080\/文件夹\/getmsg?key=1页面里面的内容?
图1:server.xml所在路径 (2)用文本编辑器打开server.xml,修改其中端口,文件中端口有很多,比如8005,8080,8009等等,别的都可以不用管,视情况修改就好,我只修改了8080端口为80,直接查找8080替换成80就OK了,修改后的文件内容如下:(3)修改server.xml文件以后,重启tomcat服务器,配置修改成功...

怎么样把TOMCAT的访问端口8080去掉啊
Tomcat可以把默认端口改为任何端口的呵呵,并不是象楼上所说的不可以改,改为HTTP的默认端口80是很简单的~ 按下面步骤:1.进入tomcat安装目录下的conf文件夹.2.用记事本或者UE等字处理软件打开server.xml文件,这个文件定义了整个服务器的规则.3.找到下面这段:<Connector port="8080" maxHttpHeaderSize=...

apache-tomcat的8080端口怎么修改成80端口?
将 8080 改成你想要的端口,如 80 即可。改完后,记得要重启tomcat!将端口改成 80 后,访问就不需要输入端口了,因为默认端口就是 80。概念 在网页服务器或超文本传输协议的后台程序中,在默认情况下,端口80(port 80)是服务器侦听网页客户端请求的端口。在NCSA服务器中,端口号可以在0~65535...

怎么去掉域名后面的8080,不修改端口号的前
更改tomcat服务器配置,配置成80端口(浏览器默认是80端口)在tomcat目录下找到 server.xml文件 打开后找到<Connector port="8080" ...\/>等代码 8080改成80

相似回答