-
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
相关推荐
小厂永远得不到的男人14 分钟前
基于 Spring Validation 实现全局参数校验异常处理roamingcode1 小时前
Claude Code NPM 包发布命令川石课堂软件测试2 小时前
技术干货|使用Prometheus+Grafana监控Tomcat实例详解gc_22992 小时前
运行npm run命令报错“error:0308010C:digital envelope routines::unsupported”毅航4 小时前
从原理到实践,讲透 MyBatis 内部池化思想的核心逻辑展信佳_daydayup5 小时前
02 基础篇-OpenHarmony 的编译工具Always_Passion5 小时前
二、开发一个简单的MCP Server用户721522078775 小时前
基于LD_PRELOAD的命令行参数安全混淆技术笃行3505 小时前
开源大模型实战:GPT-OSS本地部署与全面测评知其然亦知其所以然5 小时前
SpringAI:Mistral AI 聊天?一文带你跑通!