Centos7 设置nginx 和 tomcat 自启动

Centos7 设置nginx 和 tomcat 自启动

nginx 的 安装地址

复制代码
/usr/local/tomcat/apache-tomcat-8.5.85/bin

tomcat 的 安装地址

复制代码
/usr/local/nginx/sbin/ 

自启动脚本

  • 创建脚本 vi /etc/systemd/system/tomcat_nginx_start.service
    写入脚本信息

    [Unit]
    Description=Startup script for Tomcat and Nginx
    After=network.target

    [Service]
    Type=forking
    ExecStart=/bin/bash -c 'cd /usr/local/tomcat/apache-tomcat-8.5.85/bin && ./startup.sh && cd /usr/local/nginx/sbin/ && ./nginx -s reload'
    User=root
    Restart=always

    [Install]
    WantedBy=multi-user.target

启用脚本

复制代码
systemctl daemon-reload
systemctl enable tomcat_nginx_start.service
systemctl start tomcat_nginx_start.service
systemctl status tomcat_nginx_start.service
systemctl restart tomcat_nginx_start.service 
相关推荐
j***12152 小时前
Spring Boot中Tomcat配置
spring boot·tomcat·firefox
z***67772 小时前
SpringBoot(整合MyBatis + MyBatis-Plus + MyBatisX插件使用)
spring boot·tomcat·mybatis
小小测试开发3 小时前
JMeter JSR223预处理程序全攻略:用Groovy解锁复杂场景自动化
运维·jmeter·自动化
甄心爱学习5 小时前
计算机网络12
运维·服务器·网络
moringlightyn5 小时前
Linux---进程状态
linux·运维·服务器·笔记·操作系统·c·进程状态
shizhan_cloud6 小时前
DNS 服务器
linux·运维
优质&青年6 小时前
【Operator pormetheus监控系列四----.alertmanager和Rules服务配置】
运维·云原生·kubernetes·prometheus
IT逆夜7 小时前
linux系统安全及应用
linux·运维
苹果醋38 小时前
VueX(Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式)
java·运维·spring boot·mysql·nginx
q***3758 小时前
Nginx如何实现 TCP和UDP代理?
tcp/ip·nginx·udp