简体   繁体   English

nginx - 将PHP放入TCP而不是套接字

[英]nginx - putting PHP through TCP instead of sockets

I received error like this bellow: 我收到的错误如下:

2014/07/18 15:01:24 [error] 5700#0: *1 upstream sent too big header while reading response header from upstream, client: 1.2.3.4, server: serv_name.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "serv_name.pl"

I know to solve this problem I have to put PHP traffic through TCP instead of sockets. 我知道要解决这个问题,我必须通过TCP而不是套接字来放置PHP流量。 Only for one webb application - we have 12 webs running on nginx at the time. 仅适用于一个webb应用程序 - 我们当时在nginx上运行了12个Web。 How can I do this only for this one speciefied web app ? 我怎么能只为这个一个专门的网络应用程序做这个?

It would be enough to add in /etc/php5/fpm/pool.d directory file web_name.conf ? 添加/etc/php5/fpm/pool.d目录文件web_name.conf就足够了吗?

What should i put into this file ? 我该怎么把这个文件放进去?


I have to add more information because I messed up a bit. 我必须添加更多信息,因为我搞砸了一下。 Above error is for SQL requests and there occured parallely error 502 which is connected with socket PHP traffic - thats why I wrote about changing sockets into TCP. 上面的错误是针对SQL请求的,并且出现了与套接字PHP流量相关的并行错误502 - 这就是为什么我写了关于将套接字更改为TCP的原因。

You don't need to switch to TCP... in fact, you will end up with a performance penalty for doing so. 您不需要切换到TCP ...实际上,这样做会最终导致性能下降。 All you need to do is increase your buffer sizes. 您需要做的就是增加缓冲区大小。

fastcgi_buffers 16 8k;

You can increase this as needed for your application. 您可以根据应用需要增加此值。 You can also change the size of the buffer, but there is no reason to do this as it will automatically pick based on the page size for your system. 您也可以更改缓冲区的大小,但没有理由这样做,因为它会根据系统的页面大小自动选择。

http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_buffers http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_buffers

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM