应用服务的文件路径
1、Nginx
|
[Unit] Description=nginx - high performance web server After=network.target remote-fs.target nss-lookup.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/nginx.conf ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/usr/local/nginx/sbin/nginx -s stop [Install] WantedBy=multi-user.target |
将php源码编译目录下的 sapi/fpm/init.d.php-fpm 文件拷贝到系统配置 /etc/init.d 目录下并重命名为 php-fpm
|
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm |
2、PHP
|
[Unit] Description=php After=network.target remote-fs.target nss-lookup.target [Service] Type=forking ExecStart=/usr/local/php/sbin/php-fpm [Install] WantedBy=multi-user.target |
3、Mysql
|
[Unit] Description=mysql After=network.target remote-fs.target nss-lookup.target [Service] Type=forking ExecStart=/usr/local/mysql/support-files/mysql.server start #ExecReload=/usr/local/mysql/support-files/mysql.server restart #ExecStop=/usr/local/mysql/support-files/mysql.server stop #PrivateTmp=true [Install] WantedBy=multi-user.target |
4、Redis
|
[Unit] Description=Redis After=network.target remote-fs.target nss-lookup.target [Service] Type=forking ExecStart=/usr/local/bin/redis-server /etc/redis.conf ExecStop=kill -INT `cat /tmp/redis.pid` User=www Group=www [Install] WantedBy=multi-user.target |
上面文件修改完以后
|
systemctl daemon-reload systemctl enable xxx.service systemctl start xxx.service systemctl status xxx.service |