[tomcat] common operation records of tomcat

The following takes tomcat7.0 as an example

How to modify the port number

Configured in the xml file of
tomcat->conf->server.xml
, around line 64

<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>

The default is 8080, which can be modified here to the legal and non-conflicting port number you want


Modify the default character set of tomcat

Configure in the xml file of
tomcat->conf->server.xml
, around line 64, and finally add an attribute encoding, as follows:

<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" encoding="UTF-8"/>

How to start the project in eclipse's tomcat without entering the project name to access the project directly

step 1
Double-click the tomcat server,
Step 2
select modules,
Step 3
select the item in the table on the left, click edit on the right,
Step 4
delete the content in Path, and click OK.
Finally, remember to press ctrl+s to save, and that’s it.


How to configure tomcat to access directly without entering the port number

Configure in the xml file of
tomcat->conf->server.xml
, in line 64 or so, change 8080 to 80

<Connector connectionTimeout="20000" port="80" protocol="HTTP/1.1" redirectPort="8443" />

Because the default port of the TCP/IP protocol is 80, you can directly access tomcat when you visit, which is very useful when you build your own website.


Build your own website, why don't you enter the project name, you only need the domain name to directly access the project

First, configure it in the xml file of
tomcat->conf->web.xml
, change false to true around line 107
step 1
, and then configure it in the xml file of
tomcat->conf->server.xml
, before the tag Add to

<Context path="" docBase="D:\你的tomcat\tomcat中的项目文件夹"/>

Leaving the path blank means that you do not need to enter the project name, so if you want to change it to another name, it is also changed here.


To be continued…

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325819254&siteId=291194637