The JavaWeb Tomcat (2) - Tomcat using

1. startup and shutdown Tomcat

  (1) Open the Tomcat installation directory under the bin directory, there are four files:

    startup.bat and startup.sh, they are script files in a batch file and a Linux environment under Windows environment.

    These two documents open Tomcat service is used.

    shutdown.bat and shutdown.sh, they are script files in a batch file and a Linux environment under Windows environment.

    These two files is used to stop the Tomcat service.

  (2) to the Windows environment example, double-click the file to run startup.bat.

    When the command line shows "Server startup in [xxx] milliseconds" said that it has started Tomcat.

  

    Note: Tomcat after the start must not close the command line window, otherwise it will cause a runtime error.

    Another: If you double-click the command-line window startup.bat flash back, look at the  problem sets JavaWeb of (1) - Tomcat start flash back

  (3) If you want to end the Tomcat service, double-click the file to run shutdown.bat.

    Wait until Tomcat start command line window closes automatically, then the Tomcat service has stopped.

    Tomcat directly off the command line window is closed the wrong way, remember to remember.

 

2. Open the Tomcat Home

  After starting Tomcat service, Tomcat will provide a default home page address is  http: // localhost: 8080 / 

  

  localhost is the local address is 127.0.0.1, if you want to access other Tomcat is serving a local area network, you need to replace localhost is being accessed IP address of the host.

  8080 is the default port number, if you change the port number you need to enter the correct port number can normally access.

 

3. Modify the Tomcat port

  因为其他的应用程序可能会占用Tomcat默认的8080端口;亦或者本机需要运行一个以上的Tomcat。就需要通过修改端口来正确的运行Tomcat。

  打开Tomcat安装目录下的 conf 文件夹,用文本编辑器打开 server.xml 文件。

  

  修改 port 键的值,重新启动Tomcat服务,就可以用修改后的端口号打开Tomcat页面。

  注:端口号是从0到65535共65536个。0~255是常用端口,尽量不要用这些作为Tomcat端口;1~1023是被ICANN管理的端口,个人不要使用;可以自由使用的端口号是1024~49151;大多数的TCP/IP分配的临时端口在1024~5000之间,由应用程序自主分配。

  综上给Tomcat分配端口最好在5000~49151之间。

  常见服务器端口:MySQL - 3306;Oracle - 1521;SQL Server - 1433、1434;DB2 - 5000;MongoDB - 27017;Redis - 6379。

Guess you like

Origin www.cnblogs.com/NyanKoSenSei/p/11611061.html