- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 Digital Ocean 上有 Ubuntu 服务器,我编写了 Spring Web 应用程序,现在我想将它投入生产。
我通过 FTP 将其上传到服务器,然后通过 Putty 打开控制台并使用以下命令:
java -jar name.jar
最佳答案
而什么KLHauser建议的将起作用,但如果 vm 在云中重新启动(发生这种情况),您的应用程序将不会自动重新启动。还可以使用 kill -9
停止您的应用程序容易出错且危险,因为您可能不小心杀死了错误的进程。
参见 Spring Boot 的作为 Linux 服务运行部分关于如何做到这一点的文档。
If you’ve configured Spring Boot’s Maven or Gradle plugin to generate a fully executable jar, and you’re not using a custom
embeddedLaunchScript
, then your application can be used as aninit.d
service. Simply symlink the jar toinit.d
to support the standard start, stop, restart and status commands.The script supports the following features:
- Starts the services as the user that owns the jar file
- Tracks application’s PID using /var/run//.pid
- Writes console logs to /var/log/.log
Assuming that you have a Spring Boot application installed in
/var/myapp
, to install a Spring Boot application as an init.d service simply create a symlink:
$ sudo ln -s /var/myapp/myapp.jar /etc/init.d/myapp
Once installed, you can start and stop the service in the usual way. For example, on a Debian based system:
$ service myapp start
关于spring - 如何在 Ubuntu 服务器上安装 Spring Boot 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42970534/
我是一名优秀的程序员,十分优秀!