温馨提示×

怎么重启linux lnmp

小樊
46
2026-10-27 05:09:15
栏目: 智能运维

在 Linux 上“重启 LNMP”通常是指重启 Nginx、MySQL(或 MariaDB)、PHP-FPM 这三类服务。下面按常见情况说明。


一、使用 systemd(CentOS 7+/Ubuntu 16.04+ 等)

1. 分别重启各服务

# Nginx
systemctl restart nginx

# MySQL / MariaDB
systemctl restart mysql
# 或
systemctl restart mariadb

# PHP-FPM(版本号可能不同)
systemctl restart php-fpm
# 或
systemctl restart php7.4-fpm

2. 一键重启 LNMP(推荐脚本方式)

如果你用的是 LNMP 一键安装包:

lnmp restart

也可单独重启:

lnmp nginx restart
lnmp mysql restart
lnmp php-fpm restart

二、使用 service(老系统)

service nginx restart
service mysql restart
service php-fpm restart

三、军哥 LNMP 安装包常见命令

lnmp start    # 启动
lnmp stop     # 停止
lnmp restart  # 重启
lnmp reload   # 平滑重载(不中断服务)

四、确认是否重启成功

systemctl status nginx
systemctl status mysql
systemctl status php-fpm

或查看端口:

netstat -lntp | grep -E '80|3306|9000'

如果你能告诉我:

  • 系统版本(CentOS / Ubuntu / Debian)
  • 是否使用 LNMP 一键包
  • Nginx / PHP 版本

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

0 踩