为了与IIS的端口区别开来,Tomcat默认的端口是8080。然而很多时候,我们并不习惯于使用8080端口来访问web网站,特别是将其部署在Internet上以后,采用域名去访问它尤为不便,为此,我们希望更改Tomcat应用服务器的端口。在以前的版本中,更改端口的设置是十分方便的,只需打开Tomcat主目录中conf目录下的server.xml文件,找到其中的Connector port="8080",并将其更改为Connector port="80"即可,修改后的文件如下(有删减):
<
Service
name
="Catalina"
>
<!--
Define a non-SSL HTTP/1.1 Connector on port 8080, change it to 80.
-->
<
Connector
port
="80"
maxHttpHeaderSize
="8192"
maxThreads
="150"
minSpareThreads
="25"
maxSpareThreads
="75"
enableLookups
="false"
redirectPort
="8443"
acceptCount
="100"
connectionTimeout
="20000"
disableUploadTimeout
="true"
/>
<!--
Define a SSL HTTP/1.1 Connector on port 8443
-->
<!--
<Connector port="8443" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" />
-->
<!--
Define an AJP 1.3 Connector on port 8009
-->
<
Connector
port
="8009"
enableLookups
="false"
redirectPort
="8443"
protocol
="AJP/1.3"
/>
<!--
Define the top level container in our container hierarchy
-->
<
Engine
name
="Catalina"
defaultHost
="localhost"
>
<!--
Because this Realm is here, an instance will be shared globally
-->
<!--
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"
>
</
Host
>
</
Engine
>
</
Service
>
改动好以后,重启Tomcat,改动就生效了,应该说,还是挺方便的。
|