温馨提示×

centos lnmp如何重启

小樊
48
2026-10-15 00:54:46
栏目: 智能运维

在 CentOS 下,LNMP 一般指 Linux + Nginx + MySQL(MariaDB) + PHP。重启方式取决于你是源码安装还是使用 LNMP 一键包,下面分别说明。


一、使用 LNMP 一键安装包(最常见)

如果你是用 lnmp.org 的一键包安装的,直接执行:

lnmp restart

也可以单独重启:

lnmp nginx restart
lnmp mysql restart
lnmp php-fpm restart

查看状态:

lnmp status

二、CentOS 7 / 8(systemd 方式,源码或 yum 安装)

1. 重启 Nginx

systemctl restart nginx

2. 重启 MySQL / MariaDB

# MySQL
systemctl restart mysqld

# MariaDB
systemctl restart mariadb

3. 重启 PHP-FPM

systemctl restart php-fpm

如果 PHP 版本是 php74、php80 之类:

systemctl restart php74-php-fpm

三、CentOS 6(老系统,service 方式)

service nginx restart
service mysqld restart
service php-fpm restart

四、遇到问题怎么排查

查看服务状态

systemctl status nginx
systemctl status mysqld
systemctl status php-fpm

查看错误日志

# Nginx
/var/log/nginx/error.log

# PHP
/var/log/php-fpm/error.log

# MySQL
/var/log/mysqld.log

五、最简单的“全重启”

systemctl restart nginx mysqld php-fpm

如果你能告诉我:

  • CentOS 版本(6 / 7 / 8)
  • 是否用 LNMP 一键包
  • Nginx / PHP 是否正常运行

我可以给你更精确的重启命令。

0 踩