配置php-fpm服务到systemctl

1. 打开php-fpm.conf

sudo vim /usr/local/php/etc/php-fpm.conf

2.找到以下内容并修改

pid = /var/run/php-fpm.pid

3.新建php-fpm服务文件

sudo vim /usr/lib/systemd/system/php-fpm.service

4.内容如下

[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target

[Service]
Type=forking
PIDFile=/var/run/php-fpm.pid
ExecStart=/usr/local/php/sbin/php-fpm
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

5.重新加载systemctll配置

sudo systemctl daemon-reload

6. 开机自动启动php-fpm服务

sudo systemctl enable  php-fpm.service

7. 状态管理

systemctl start php-fpm
systemctl status php-fpm
systemctl stop php-fpm
systemctl restart php-fpm
systemctl enable php-fpm
systemctl didable php-fpm

 

posted on 2020-07-31 13:15  睡着的糖葫芦  阅读(1983)  评论(0编辑  收藏  举报