温馨提示×

Debian LNMP如何重启

小樊
42
2026-10-13 16:03:59
栏目: 智能运维

在 Debian 上“LNMP”通常指 Linux + Nginx + MySQL/MariaDB + PHP,重启方式取决于你是用 apt 直接安装 还是 LNMP 一键脚本 安装的。


一、使用 apt 安装的 LNMP(标准 Debian 方式)

1. 重启 Nginx

systemctl restart nginx

查看状态:

systemctl status nginx

2. 重启 MySQL / MariaDB

Debian 通常安装的是 MariaDB:

systemctl restart mariadb

或

systemctl restart mysql

查看状态:

systemctl status mariadb

3. 重启 PHP-FPM(如 PHP 7.4 / 8.1 / 8.2)

先确认 PHP 版本:

php -v

例如 PHP 8.1:

systemctl restart php8.1-fpm

通用写法(按版本改):

systemctl restart phpX.X-fpm

4. 一次性重启全部(LNMP)

systemctl restart nginx mariadb php8.1-fpm

二、使用 LNMP 一键安装脚本(军哥 LNMP)

如果你是用 lnmp.org 的脚本安装的:

重启 LNMP

lnmp restart

单独重启

lnmp nginx restart
lnmp mysql restart
lnmp php-fpm restart

三、常见问题排查

Nginx 配置错误

nginx -t

查看错误日志

tail -n 50 /var/log/nginx/error.log
tail -n 50 /var/log/mysql/error.log

如果你能告诉我:

  • Debian 版本(如 11 / 12)
  • Nginx / MySQL / PHP 版本
  • 是 apt 安装还是 LNMP 脚本

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

0 踩