springboot jar packaging deploy Linux

The following major record what steps springboot packaged into a jar package deployed on Linux services:

1, will be labeled as a Jar file, copied to the Linux specified directory, such as / home /

2, open ssh, enter the / home directory, run the following command to boot the project, which started way back, even if you close the current window, the project is still in the running, will generate nohup.out log file, you can view the boot log

  nohup java -jar XXX.jar

3, stop the project, first of all you need to check the progress of the project's PID, view the following command

  ps aux|grep XXX

  

As above, the second column information that is PID process of the project, execute the following details, the end of the process.

  kill -9 29135

In the actual process, when we normally start the project, while access in the browser, there will be access problems, remove the cause of the network, the most likely Liunx firewall is blocking our access.

Solution:

①, using the next WinSCP etc / sysconfig directory, open a file iptables add port mapping position shown below, i.e., we need to access the port number

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

②, restart the firewall service, make it work

  service iptables restart

③, view firewall service, make sure to add success

  service iptables status

 

ok!

Original link: https://www.cnblogs.com/conswin/p/9896732.html

Guess you like

Origin blog.csdn.net/xiaomojun/article/details/87945991