Tomcat installation configuration

Tomcat configuration

1. Download the Tomcat configuration package from the official website: http://tomcat.apache.org/download-70.cgi

2. After downloading, rename the entire decompressed folder: ApacheTomcat (the name is arbitrary), and then put it in a file directory, I put it under: /Users/computer username/Library;

3. Open the terminal and enter the bin folder directory in the ApacheTomcat file;

4. Then start Tomcat, enter: ./startup.sh in the terminal, if a prompt appears: -bash: ./startup.sh: Permission denied, the startup fails, and the terminal needs to enter: chmod u+x *.sh authorization;

5. After authorization, enter the terminal again: ./startup.sh, as shown in the figure below, the startup is successful;

6. Check whether the startup is successful, open it in the browser: http://localhost:8080 [localhost can be replaced with your IP address], if the page below is displayed, it has been started normally;

7. Close Tomcat, or in the bin folder directory, enter the terminal: ./shutdown.sh

folder directory

1) bin: store tomcat commands

2) conf: store tomcat configuration information, the server.xml file inside is the core configuration file

3) lib: jar package and technical support package (such as servlet and jsp) that support tomcat software running

4) logs: log information at runtime

5) temp: temporary directory

6) webapps: shared resource files and web application directories

7) work: the running directory of tomcat. Temporary files generated when jsp is running are stored here

Modify the port number

The default port of the server is 8080, it can also be changed to a custom port, in order to avoid conflict with the system port, it must be set to 1024 or higher, for example, set to 8888

Open the server.xml file in the conf directory of ApacheTomcat with Notepad, and change the port value 8080 of the following statement to a custom port number: (for example, 8020)

<Connector port="8020" protocol="HTTP/1.1"

          connectionTimeout="20000"

          redirectPort="8443" />

After restarting the server, entering localhost:8080 is invalid. You need to enter localhost:8020 to open the server interface.

password setting

Add the following code to the tomcat-users.xml file in the conf directory</tomcat-users>:

<role rolename="manager-gui"/>

<user username="tomcat" password="tomcat" roles="manager-gui"/>

Because the xml tag must be closed, and tomcat must be restarted. Re-open http://localhost:8080 to the Tomcat main interface, click on buttons such as Manager App, and enter tomcat with the account and password to log in.

 

Guess you like

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