在 Linux + LNMP(Linux + Nginx + MySQL/MariaDB + PHP) 环境下,**“重启 LNMP 服务”**通常包含 Nginx、MySQL、PHP-FPM 三个服务。下面按常见情况说明:
如果你用的是 lnmp.org 的一键安装包:
lnmp restart
仅重启某个服务:
lnmp nginx restart
lnmp mysql restart
lnmp php-fpm restart
systemctl restart nginx
systemctl restart mysql
# 或
systemctl restart mariadb
systemctl restart php-fpm
# 如果版本不同,例如 PHP 7.4
systemctl restart php7.4-fpm
systemctl restart nginx mysql php-fpm
service nginx restart
service mysql restart
service php-fpm restart
如果你只是修改了配置文件:
nginx -s reload
systemctl reload php-fpm
systemctl reload mysql
systemctl status nginx
systemctl status mysql
systemctl status php-fpm
如果重启失败,先看日志:
journalctl -xe
cat /var/log/nginx/error.log
如果你告诉我:
我可以给你最准确的一条命令 ✅