温馨提示×

debian lnmp怎么重启

小樊
39
2026-07-30 08:19:16
栏目: 智能运维

Debian + LNMP(Linux + Nginx + MySQL/MariaDB + PHP) 环境下,重启一般是对 Nginx、MySQL/MariaDB、PHP-FPM 分别操作。下面给你最常用、最稳妥的方法。


一、重启 Nginx

sudo systemctl restart nginx

查看状态:

sudo systemctl status nginx

二、重启 MySQL / MariaDB

Debian 常见的是 MariaDB,命令通用:

sudo systemctl restart mariadb

如果是 MySQL:

sudo systemctl restart mysql

查看状态:

sudo systemctl status mariadb
# 或
sudo systemctl status mysql

三、重启 PHP-FPM

先确认 PHP 版本(例如 7.4、8.1、8.2):

php -v

常见重启命令:

sudo systemctl restart php8.2-fpm

如果不确定服务名:

systemctl list-units | grep php

四、一次性重启 LNMP(推荐)

如果你不想记那么多,可以这样:

sudo systemctl restart nginx
sudo systemctl restart mariadb
sudo systemctl restart php8.2-fpm

五、只重载(不中断服务,推荐)

如果只是改了配置:

sudo systemctl reload nginx
sudo systemctl reload php8.2-fpm

六、如果 systemctl 不可用(老系统)

sudo service nginx restart
sudo service mariadb restart
sudo service php8.2-fpm restart

七、常见问题排查

Nginx 启动失败:

sudo nginx -t

PHP 不生效:

sudo systemctl status php8.2-fpm

如果你愿意,可以告诉我:

  • Debian 版本(10 / 11 / 12)
  • PHP 版本
  • LNMP 一键包 还是 手动安装

我可以给你更精确的命令 ✅

0