Nginx无法启动
nginx -t
检查配置文件语法 。netstat -tuln
查看端口占用情况,修改 nginx.conf
中的 listen
端口 。sudo apt-get install nginx mysql-server php-fpm
(Ubuntu/Debian)。MySQL无法启动
my.cnf
配置文件路径和语法 。chown -R mysql:mysql /var/lib/mysql
。my.cnf
中的 port
。PHP-FPM无法启动
php-fpm -t
检查配置文件 。pm.max_children
参数以适配服务器内存 。listen.owner
和 listen.group
与 Nginx 用户一致(如 www-data
)。nginx.conf
中 fastcgi_pass
是否指向正确的PHP-FPM监听地址(如 unix:/var/run/php/php7.4-fpm.sock
)。listen
配置与Nginx一致,且用户/组权限正确 。/var/log/nginx/error.log
和 /var/log/php-fpm/error.log
定位具体错误 。chown -R www-data:www-data /var/www/html
,文件权限 644
,目录权限 755
。www-data
)对相关路径有读写权限 。nginx -t
和 php-fpm -t
测试配置文件语法 。root
、fastcgi_pass
等路径是否正确 。ufw allow 80/443/9000
(Ubuntu)或 firewall-cmd --add-port=9000/tcp --permanent
(CentOS)。ufw disable
或 systemctl stop firewalld
。php-fpm.conf
中的 pm.max_children
,根据服务器内存调整(如 pm.max_children = 20
)。innodb_buffer_pool_size
),参考官方文档调整 。update-alternatives
切换默认PHP版本(Ubuntu/Debian)。/var/log/nginx/error.log
/var/log/php-fpm/error.log
/var/log/mysql/error.log
tail -f
实时查看日志:tail -f /var/log/nginx/error.log
。提示:修改配置后需重启服务生效,优先通过 systemctl restart nginx php-fpm mysql
重启,避免直接使用 service
命令(部分系统已弃用)。若问题仍未解决,可参考官方文档或社区论坛(如Stack Overflow、SegmentFault)搜索具体错误信息。