上海纽斯达科技 Nginx 常见错误与解决方法 上海纽斯达科技有限公司 2014-10-25 文档状态 目的: 在Nginx 服务器出现故障时,能快速定位并解决相关错误。 保密: 本文档仅供内部使用,请勿外传 概述: Nginx 常见错误与问题之解决方法技术指南。 安装环境: 系统环境:redhat enterprise 6.5 64bit 文件状态: 【 】草稿 【 】修改稿 【√】正式发布 文档编号 Nsdkj-778 保 密 等 级 限制 作 者 刘恒亮 最后完成日期 2014-12-25 审 核 人 最后审核日期 2014-12-25 批 准 人 最后批准日期 2014-12-25 1、Nginx 常见启动错误 有的时候初次安装 nginx 的时候会报这样的错误 sbin/nginx -c conf/nginx.conf 报错内容:sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory 启动时如果报异常 error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory 这说明我们的环境还不是和启动需要 小小的配置一下 解决方法(直接运行): 32 位系统 [root@sever lib]# ln -s /usr/local/lib/libpcre.so.1 /lib 64 位系统 [root@sever lib]# ln -s /usr/local/lib/libpcre.so.1 /lib64 然后执行 ps -ef | grep nginx 查看 nginx 进程确认是否真的已经启动了,在进程列表里会 有最起码两个, worker(nginx 工作进程)和 master(nginx 主进程) root 4349 1 0 02:24 ? 00:00:00 nginx: master process sbin/nginx -c conf/nginx.conf nginx 4350 4349 0 02:24 ? 00:00:00 nginx: worker process root 4356 28335 0 02:30 pts/1 00:00:00 grep nginx NGINX 就 OK 了 2、400 bad request 错误的原因和解决办法 配置 nginx.conf 相关设置如下. client_header_buffer_size 16k; large_client_header_buffers 4 64k; 根据具体情况调整,一般适当调整值就可以。 3、Nginx 502 Bad Gateway 错误 在 php.ini 和 php-fpm.conf 中分别有这样两个配置项:max_execution_time 和request_terminate_timeout。 这两项都是用来配置一个PHP 脚本的最大执行时间的。当超过这个时间时,PHP-FPM 不只会终止脚本的执行, 还会终止执行脚本的Worker 进程。所...