米狗

  • kubernets
  • docker
  • AWS
  • linux
  • nginx
Kratos
  1. 首页
  2. 中间件
  3. nginx
  4. 正文

nginx注册服务

2024年10月28日 564点热度 0人点赞 0条评论
将nginx添加为系统服务
则可以使用以下命令来管理nginx
systemctl start nginx
systemctl status nginx
systemctl stop nginx
systemctl restart nginx
直接编辑文件
vim /lib/systemd/system/nginx.service

将以下内容复制粘贴保存,路径按照实际路径填写。

[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target

[Service] 
Type=forking
ExecStartPre=/app/nginx/sbin/nginx -t -c /app/nginx/conf/nginx.conf
ExecStart=/app/nginx/sbin/nginx -c /app/nginx/conf/nginx.conf
ExecReload=/app/nginx/sbin/nginx -s reload
ExecStop=/app/nginx/sbin/nginx -s stop
PrivateTmp=true

[Install] 
WantedBy=multi-user.target
执行重启systemctl,实现nginx开机自启
systemctl daemon-reload
systemctl enable nginx

 

标签: 暂无
最后更新:2024年10月28日

megou

这个人很懒,什么都没留下

点赞
< 上一篇

归档

  • 2024 年 10 月
  • 2024 年 4 月
  • 2024 年 3 月
  • 2024 年 2 月
  • 2024 年 1 月
  • 2023 年 11 月
  • 2023 年 4 月
  • 2023 年 2 月
  • 2023 年 1 月
  • 2022 年 11 月
  • 2022 年 10 月
  • 2022 年 9 月
  • 2022 年 8 月
  • 2021 年 12 月
  • 2021 年 11 月
  • 2021 年 8 月
  • 2021 年 7 月
  • 2021 年 6 月
  • 2021 年 2 月
  • 2020 年 1 月
  • 2019 年 12 月
  • 2019 年 11 月
  • 2019 年 10 月
  • 2019 年 9 月
  • 2019 年 8 月

分类目录

  • AWS
  • docker
  • elasticsearch
  • Jenkins
  • kubernets
  • linux
  • mysql
  • nginx
  • Oracle
  • php
  • redis
  • zabbix
  • 个人
  • 中间件
  • 公有云
  • 大数据
  • 安全工具
  • 微软
  • 操作系统
  • 数据库
  • 未分类
  • 监控
  • 科技
  • 网络技术
  • 资讯
  • 阿里云

COPYRIGHT © 2024 米狗. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

沪ICP备2021019346号-1