将Nginx配置成系统开机启动服务
# 如何将nginx配置成我们的系统服务 # 1.在/usr/lib/systemd/system目录下面配置nginx.service内容 # 如果想要详细了解制作的过程:https://blog.csdn.net/weixin_40596016/article/details/90485038 vim /usr/lib/systemd/system nginx.service [Unit] Description=nginx web service Documentation=http://nginx.org/en/docs/ After=network.targe [Service] Type=forking PIDFile=/usr/local/nginx/logs/nginx.pid ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/usr/local/nginx/sbin/nginx -s stop PrivateTmp=True [Install] wanteBy=default.target # 2.分配权限 chmod 755 /usr/lib/systemd/system/nginx.service # 3.systemctl命令 systemctl start nginx systemctl stop nginx systemctl restart nginx systemctl status nginx systemctl enable nginx # 开机启动 # 4.将nginx配置到系统环境变量中 # 只需要在/etc/profile文件最后加上vim /etc/profile export PATH=$PATH:/usr/local/nginx/sbin
标签:
Nginx
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?