CentOS设置nginx开机自启动

2023-04-12


systemd


在CentOS7中,systemctl命令主要负责控制systemd系统和服务管理器。常用命令如下:


systemctl --version,查看版本。
whereis systemctl,查看位置。
systemctl list-unit-files,列出所有可用单元(服务)。
systemctl list-units,列出所有运行中的单元。
systemctl --failed,列出所有失败的单元。
systemctl list-unit-files | grep enable,查看自启动的软件。
systemctl is-enabled mysqld.service,查看某个单元是否开机启动。
systemctl status mysqld.service,查看某个单元的状态。
systemctl start mysqld.service,启动某个单元。
systemctl restart mysqld.service,重启某个单元。
systemctl stop mysqld.service,停止某个单元。
systemctl daemon-reload,修改了某个单元的配置文件后,重载配置文件。
systemctl reload mysqld.service,重载某个单元。
systemctl enable mysqld.service,设置开机自启动。
systemctl disable mysqld.service,关闭开机自启动。
systemctl kill mysqld,杀死单元。

systemctl命令


设置开机自启动


systemctl enable nginx.service


查看nginx状态


systemctl status nginx.service


杀死nginx重启nginx


pkill -9 nginx


ps aux | grep nginx


systemctl start nginx




本文仅代表作者观点,版权归原创者所有,如需转载请在文中注明来源及作者名字。

免责声明:本文系转载编辑文章,仅作分享之用。如分享内容、图片侵犯到您的版权或非授权发布,请及时与我们联系进行审核处理或删除,您可以发送材料至邮箱:service@tojoy.com