linux 下system源码,[步骤] Linux Nginx 源码安装包的管理(通过 systemd 实现)

注意:在通过 systemd 管理源码安装的软件或自制 rpm 包安装的软件(以 Nginx 为例)之前,先要源码安装 Nginx 或者自制 rpm 包安装 Nginx

正文:

步骤目录:

步骤一:创建 Nginx 的 systemd 文件

步骤二:导入新创建的 Nginx systemd 配置文件

步骤三:使用 systemd 管理 Ngixn

3.1 使用 systemd 启动 Nginx

3.2 使用 systemd 开机自启 Nginx

3.3 使用 systemd 查看 Nginx 的状态

具体的操作步骤:

步骤一:创建 Nginx 的 systemd 文件

# vim /etc/systemd/system/nginx.service

创建以下内容:

[Unit]

Description=nginx server daemon

Documentation=man:nginx(8)

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 stop

PrivateTmp=true

[Install]

WantedBy=multi-user.target

步骤二:导入新创建的 Nginx systemd 配置文件

# systemctl daemon-reload

步骤三:使用 systemd 管理 Ngixn

3.1 使用 systemd 启动 Nginx

# systemctl start nginx.service

3.2 使用 systemd 开机自启 Nginx

# systemctl enable nginx.service

3.3 使用 systemd 查看 Nginx 的状态

# systemctl status nginx.service

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值