“Linux LNMP 报错”范围太广了,需要先看具体报错信息才能准确判断。不过,LNMP(Linux + Nginx + MySQL/MariaDB + PHP)常见报错原因主要有以下几类,你可以对照排查:
常见原因:
netstat -lntp | grep 80
nginx -t
ls -l /home/wwwroot/
最常见原因:
ps aux | grep php-fpm
systemctl status php-fpm
fastcgi_pass 地址写错(如 127.0.0.1:9000 或 unix:/tmp/php-fpm.sock)df -h
chown -R mysql:mysql /var/lib/mysql
mysqld --verbose --help
error_reporting(E_ALL);
ini_set('display_errors', 1);
mysqli、gd、curl)www.conf 中 user/group 不对listen 权限不足(socket 文件)chown -R www:www /home/wwwroot
chmod -R 755 /home/wwwroot
setenforce 0
# 或
getsebool -a | grep httpd
systemctl status firewalld
iptables -L
请把以下信息贴出来(越多越好):
例如:
CentOS 7,lnmp.org 一键安装,访问网站显示 502,nginx 日志提示
connect() failed (111: Connection refused) while connecting to upstream
我可以直接告诉你改哪里。