“Linux LNMP 报错”是一个很宽泛的说法,因为 LNMP(Linux + Nginx + MySQL/MariaDB + PHP)任何一层出问题都会报错。下面我按常见报错场景给你分类说明,你可以对照看是哪一种,也可以把具体报错信息贴出来,我帮你精确定位。
systemctl start nginx
Job for nginx.service failed
常见原因:
netstat -lntp | grep :80
nginx -t
原因:
chown -R www:www /网站目录
chmod -R 755 /网站目录
原因:
systemctl status php-fpm
fastcgi_pass 路径错误fastcgi_pass unix:/run/php-fpm/www.sock;
display_errors 没开phpinfo();
tail -f /var/log/php-fpm/error.log
Call to undefined function 等ERROR 2002 (HY000): Can't connect to local MySQL server
原因:
systemctl start mysqld
ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';
setenforce 0
你可以先执行这些:
nginx -t
systemctl status nginx
systemctl status php-fpm
systemctl status mysqld
tail -n 50 /var/log/nginx/error.log
你可以直接发:
我可以一步一步帮你修。