-
nginx启动命令
bash/usr/local/nginx/sbin/nginx ./nginx # ./代表从当前目录找nginx
-
nginx停止命令
bash/usr/local/nginx/sbin/nginx -s quit ./nginx -s quit
-
tomcat启动命令 /usr/local/tomcat/bin/startup.sh ./startup.sh
-
tomcat停止命令
arduino/usr/local/tomcat/bin/shutdown.sh ./shutdown.sh
设置nginx和tomcat开机自动启动要告诉操作系统nginx启动命令在哪,tomcat启动命令在哪
systemctl nginx.service/nginx
arduinocd /lib/systemd/system //存放由操作系统管理的启动程序 vim nginx.service //创建一个nginx服务文件
写入以下内容
ini[Unit] Description=nginx After=network.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginx ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/usr/local/nginx/sbin/nginx -s quit PrivateTmp=true [Install] WantedBy=multi-user.target
创建好这个服务文件后,启动nginx就可以在任何目录中使用
systemctl [操作] nginx.service/nginx
bashsystemctl stop nginx #停止 systemctl restart nginx #重启 systemctl status nginx #状态 systemctl enable nginx #允许开机自动启动 systemctl disable nginx #禁止开机自动启动(默认)
-
设置可以在任何目录中使用 systemctl [操作] tomcat 来操作 tomcat 程序 创建tomcat.service服务文件
/lib/systemd/system/tomcat.service
arduinocd /lib/systemd/system //存放由操作系统管理的启动程序 vim tomcat.service //创建一个tomcat服务文件
写入以下内容
ini[Unit] Description=Apache Tomcat 8 After=syslog.target network.target [Service] Type=forking ExecStart=/usr/local/tomcat/bin/startup.sh ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/usr/local/tomcat/bin/shutdown.sh PrivateTmp=true [Install] WantedBy=multi-user.target
创建好这个服务文件后,启动tomcat就可以在任何目录中使用systemctl [操作] tomcat.service/tomcat
bashsystemctl stop tomcat #停止 systemctl restart tomcat #重启 systemctl status tomcat #状态 systemctl enable tomcat #允许开机自动启动 systemctl disable tomcat #禁止开机自动启动(默认)
设置nginx和tomcat开机自动启动
吓死羊了2025-07-08 10:32
相关推荐
Warren981 小时前
Java Stream流的使用程序视点2 小时前
IObit Uninstaller Pro专业卸载,免激活版本,卸载清理注册表,彻底告别软件残留xidianhuihui2 小时前
go install报错: should be v0 or v1, not v2问题解决进击的铁甲小宝3 小时前
Django-environ 入门教程掘金码甲哥4 小时前
Go动态感知资源变更的技术实践,你指定用过!做一位快乐的码农4 小时前
基于Spring Boot和Vue电脑维修平台整合系统的设计与实现王柏龙4 小时前
ASP.NET Core MVC中taghelper的ModelExpression详解无限大64 小时前
算法精讲:二分查找(二)—— 变形技巧勇哥java实战分享5 小时前
基于 RuoYi-Vue-Pro 定制了一个后台管理系统 , 开源出来!