CentOS · 2021年11月17日 0

CentOS7服务器操作Apache、MySQL、php-fpm、Nginx

Apache

重启 systemctl restart httpd                         #systemctl restart httpd.service 
停止 systemctl stop httpd                             #systemctl stop httpd.service
启动 systemctl start httpd                            #systemctl start httpd.service
设置开机启动 systemctl enable httpd        #systemctl enable httpd.service/systemctl disable httpd.service
检查httpd状态 systemctl status httpd.service

mysql
启动 systemctl start mysqld
停止 systemctl stop mysqld
重启 systemctl restart mysqld

php-fpm
启动 systemctl start php-fpm
停止 systemctl stop php-fpm
重启 systemctl restart php-fpm

nginx
启动 systemctl start nginx
停止 systemctl stop nginx
重启 systemctl restart nginx

https://www.cnblogs.com/zhang-ding-1314/p/8403819.html

查看开机启动项(服务)

想知道这些服务开机有没有自启服务,查询了一下网上都讲到chkconfig,但是centos7已不用chkconfig了

解决方法:

使用 systemctl list-unit-files 可以查看启动项 

左边是服务名称,右边是状态,enabled是开机启动,disabled是开机不启动

过滤查询可以systemctl list-unit-files | grep enable 过滤查看启动项如下

过滤查询可以systemctl list-unit-files | grep zabbix 过滤查看某服务名如下