Ali cloud Tomcat configuration

Ali cloud Tomcat configuration and open

  1. This article provides a reference to the following questions
    • How to configure Tomcat server configuration
    • Port listening, but outside the network can not access how to do
  2. Precautions:
    • For Ali cloud servers is relatively unique because Ali cloud server in addition to the open port on the system, but also need to set the security group in Ali cloud server
    • Centos7 and Centos6 firewalls are different, Centos7 default is firewalld, but Centos6 default using iptables. 
  3. Configuring Tomcat project
    • Download:  https://tomcat.apache.org/download-80.cgi   you can download different versions according to their needs
    • The downloaded files to a directory under server, customizable, mine is ~ / tomcat /, the subsequent description will also be introduced as an example, we can flexibly change.
    • Unzip
      • the tar - zxvf downloaded file name 
        # Example: the tar -zxvf-tomcat- Apache 8.5 . 51 is . the tar .gz

         

    • Configure the environment variables (note that this operation requires root privileges)
      • VI / etc / Profile 
        # input to a last line to enter the edit mode, and then begin the configuration 
        # Tomcat Configuration 
        Export CATALINA_HOME = / Home / MyPro / Tomcat / Apache-tomcat- 8.5 . 51 is 
        Export the PATH = the PATH $: $ CATALINA_HOME / bin 
        
        # after editing save (enter: wq number, and then enter into), then re-read the file in the current environment and execute bash 
        Source / etc / Profile
    • Start Tomcat (Tomcat into the decompression folder, which is the Tomcat project-related directory)
      • cd apache-tomcat-8.5.51/bin
        ./startup.sh

         

    • View startup state
      • # 8080 is the default port for Tomcat If Tomcat service can not start, you need to exclude themselves whether the 8080 port has been occupied 
        netstat -anp | grep  8080
  4. Ali cloud server security group configuration
    • Enter the security group management interface (this interface may have with Ali engineers version of iterations to change position, you can find it)
    • The rules for their own server configuration
      •  

    • Add the security group rules, and fill out the information as shown below
      •  

         Note that you need to restart the server after the security group configuration is complete. (After restart may Tomcat If it does not, it was introduced to start the second module in accordance)

  5. System firewall configuration
    • This section includes starting a service, open ports, note that the port must be open to the press after the restart firewall. Related specified as follows
      • # View firewall service status 
        systemctl Status firewalld 
        # View the status of firewall 
        firewall -cmd - State 
        # turn on firewall service 
        Service firewalld Start 
        # restart the firewall service 
        Service firewalld restart 
        # close the firewall service 
        Service firewalld STOP 
        # query port is open 
        firewall -cmd - = port-Query 8080 / TCP 
        # 8080 port open 
        firewall -cmd --permanent --add-port = 8080 / TCP 
        # removal port 
        firewall -cmd --permanent --remove-port = 8080 / TCP 
        
        # reboot the firewall (modified after you configure to restart the firewall) 
        firewall -cmd --reload

         

  6. Test results
    • Whether port 8080 is being monitored command: Telnet -ano | grep 8080
    • Whether the 8080 port security rule has been configured (Ali console)
    • Whether the 8080 port is already open firewall-cmd --query-port = 8080 / tcp
    • Extranet browser input: success appears Tomcat Home Help
      • HTTP: // server IP: 8080 /

         

    •   

       

      The above is summarized in my own situation, if you have other questions please contact me, I will try to answer, if there is something wrong, please correct me.

    • Useful words on the point of attention to it, your support is my motivation

Guess you like

Origin www.cnblogs.com/StevenZheng/p/12465920.html