关键词不能为空

当前您在: 主页 > 英语 >

Nginx常见错误与解决方法

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-02-15 14:42
tags:

-

2021年2月15日发(作者:放声大笑)


上海纽斯达科技






















Nginx


常见错误与解决方法









上海纽斯达科技有限公司



2014-10-25




文档状态



文件状态:





】草稿





】修改稿



文档编号













Nsdkj-778


刘恒亮













最后完成日期



最后审核日期



最后批准日期



限制



2014-12-25


2014-12-25


2014-12-25




】正式发布










目的:




N ginx


服务器出现故障时,能快速定位并解决相关错误。




保密:



本文档仅供内部使用,请勿外传




概述:



Nginx

< br>常见错误与问题之解决方法技术指南。




安装环境:



系统环境:


redhat enterprise 6.5 64bit















1



Nginx


常见启动错误



< br>有的时候初次安装


nginx


的时候会报这样的错误




sbin/nginx -c conf/



报错内容:


sbin/nginx: error while loading shared libraries: .1:



cannot open shared object file: No such file or directory



启动时如果报异常


error while loading shared libraries: .1: cannot open



shared object file: No such file or directory


这说明我们的环境还不是和启动需要




小小的配置一下



解决方法


(


直接运行


)




32


位系统


[root@sever lib]# ln -s /usr/local/lib/.1 /lib


64


位系统


[root@sever lib]# ln -s /usr/local/lib/.1 /lib64



然后执行


ps -ef | grep nginx


查看


nginx


进程确认是否真的已经启动了, 在进程列表里会




有最起码两个,


worker(nginx

< br>工作进程


)



master



nginx


主进程)



root 4349 1 0 02:24 ? 00:00:00 nginx: master process sbin/nginx -c



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


错误的原因和解决办法




配置



相关设 置如下


.



client_header_buffer_size 16k;


large_client_header_buffers 4 64k;



根据具体情况调整,一般适当调整值就可以。




3



Nginx 502 Bad Gateway


错误








中分别有这样两个配置项:


max_execution_time

< br>和


request_terminate_timeout




这两项都是用来配置一个


PHP


脚本的最大执行时间的。当超过这个时间时,


PHP- FPM


不只会终止


脚本的执行,



还会终止执行脚本的


Worker


进程。所 以


Nginx


会发现与自己通信的连接断掉了,就会返回给客< /p>


户端


502


错误。





PHP-FPM



request_terminate_timeout=30

< p>
秒时为例,报


502 Bad Gateway


错误的具体信息


如下:



1



Nginx


错误访问日志:



2013/09/19 01:09:00 [error] 27600#0: *78887 recv() failed (104: Connection reset


by peer) while reading response header from upstream,


client: 192.168.1.101, server: , request:


HTTP/1.1


host:



2



PHP- FPM


报错日志:



WARNING: child


25708


exited


on


signal


15


(SIGTERM)


after


21008.883410


seconds


from


start


< p>
所以只需将这两项的值调大一些就可以让


PHP


脚 本不会因为执行时间长而被终止了。


request_terminate_timeo ut


可以覆盖


max_execution_time




所以如果不想改全局的


,那只改


PHP- FPM


的配置就可以了。




此外要注意的是


Nginx


< br>upstream


模块中的


max_fail

< p>


fail_timeout


两项。有时


Nginx


与上


游服务器(如

< br>Tomcat



FastCGI


)的通信只是偶然断掉了,




max _fail


如果设置的比较小的话,那么在接下来的


fail_ timeout


时间内,


Nginx


都 会认为上


游服务器挂掉了,都会返回


502

错误。



所以可以将


max_fa il


调大一些,将


fail_timeout

< br>调小一些。




4



Nginx


出现的


413 Request Entity Too Large


错误




这个错误一般在上传文件的时候会出现,




编辑


Nginx

主配置文件



,找到


http{}< /p>


段,添加




client_max_body_size 10m; //


设置多大根据自己的需求作调整


.



如果运行


php

的话这个大小


client_max_body_size


要和



中的如下值的最大值一致或




者稍大,这样就不会因为提交数据大小不一致出现的错误。




post_max_size = 10M

-


-


-


-


-


-


-


-



本文更新与2021-02-15 14:42,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/655498.html

Nginx常见错误与解决方法的相关文章