- 在系統(tǒng)服務(wù)目錄中創(chuàng)建 php-fpm.service 文件
vim /lib/systemd/system/php-fpm.service
- 編輯服務(wù)文件
[Unit]
Description=php-fpm
After=network.target
[Service]
Type=forking
ExecStart=/home/work/study/soft/php/sbin/php-fpm
ExecStop=/bin/pkill -9 /home/work/study/soft/php/sbin/php-fpm
PrivateTmp=true
[Install]
WantedBy=multi-user.target
- 查看服務(wù)狀態(tài)
netsta -ntlp | grep php-fpm
ps -ef | grep php-fpm
- 關(guān)閉服務(wù)
pkill -9 php-fpm
- 啟動服務(wù)
systemctl start php-fpm.service
- 開啟成功后,將服務(wù)加入到開機(jī)自啟動
systemctl enable php-fpm.service
創(chuàng)建成功的標(biāo)識
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.
- 重啟服務(wù)器
shutdown -r now
reboot
- 查看運(yùn)行的服務(wù)
systemctl list-units --type=service
參考資料
nginx 開機(jī)自啟動:http://www.itdecent.cn/p/d869d2f20a4f
php-fpm 開機(jī)自啟動:http://www.itdecent.cn/p/33b44a14ebf7

image.png