Nginx+php-fpm 502 504 problem php-fpm nginx 504 java nginx php 50

WBOY
Release: 2016-07-29 08:49:03
Original
1398 people have browsed it

Recently, 502,504 errors often occur in the self-study IT forum (www.zixue.it)

Environment:

Host: Alibaba Cloud dual-core CPU 2G memory
OS: centos 6.4 64-bit

Idea:

Increase the size and number of cache files when nginx communicates with php-fpm
Static binding of 5 php-fpm processes reduces the cost of starting processes frequently
Use sock files instead of tcp port communication (local machine performance can be improved by about 10%)
Solution:

Adjust the parameters of Nginx and php-fpm as follows

nginx.conf location section

<code>unix:/usr/<span>local</span>/php/<span>var</span>/run/php<span>-fpm</span><span>.</span>sock</code>
Copy after login

fastcgi.conf Modify the content

<code>fastcgi_buffers 32 128k;
fastcgi_buffer_size 128k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;</code>
Copy after login

php-fpm.conf

listen = /usr/local/php/var/ run/php-fpm.sock

Reminder: Don’t forget to add read and write permissions to php-fpm.sock

<code>pm = <span>static</span><span># 静态绑定5个进程</span>
pm.max_children = <span>5</span></code>
Copy after login

Effect:

The forum homepage is about 30 milliseconds faster, and after 2 weeks of clinical observation, it has not happened again. 502,504 error

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above has introduced the Nginx+php-fpm 502 504 problem, including nginx and 504 content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!