“Debian + LNMP 报错”范围比较大,我给你一套通用排查思路 + 常见错误速查表,你可以对照看;如果方便,把具体报错信息贴出来,我可以精确帮你定位。
不同方式排错不一样:
下面以「Debian + 原生或一键包 LNMP」为主
systemctl status nginx
systemctl status mysql
systemctl status php-fpm
❌ 如果 failed → 看日志
# Nginx
tail -n 50 /var/log/nginx/error.log
# PHP
tail -n 50 /var/log/php*-fpm.log
# MySQL
tail -n 50 /var/log/mysql/error.log
ss -lntp | grep -E '80|443|3306|9000'
常见冲突:
报错示例
Job for nginx.service failed
✅ 解决:
nginx -t
通常是:
server_name / root 路径不对说明 Nginx 没把请求转给 PHP
✅ 检查:
location ~ \.php$ {
fastcgi_pass unix:/run/php/php-fpm.sock;
include fastcgi_params;
}
PHP 版本路径要对(如 php8.2-fpm.sock)
最常见原因:
systemctl restart php8.2-fpm
报错
Can't connect to local MySQL server
✅ 检查:
systemctl status mariadb
journalctl -xe
常见:
/var/lib/mysql 权限错Debian 12 默认:
旧程序(WordPress 老版本、Discuz)可能报错
✅ 方案:
nginx -t 通过www-data直接贴:
cat /etc/os-release)我可以一步一步帮你修 ✅