Home >Backend Development >PHP Tutorial >Will there be a 502 on the page? How to check? Is the number of visits too high?
Written in PHP, will a 502 appear on the page? How to check? Is it because the number of visits is too large?
Written in PHP, will a 502 appear on the page? How to check? Is it because the number of visits is too large?
Probably check these first
Number of FastCGI processes
Nginx waits for php execution time
<code>fastcgi_connect_timeout 0; fastcgi_send_timeout 0; fastcgi_read_timeout 0;</code>
3.php memory limit
<code>memory_limit</code>
If nginx is used for load balancing before, check the nginx log first
To put it bluntly, it means that the backend is down. Of course, it is not necessarily PHP. If you see 502 using CDN, it may be that the origin site is down.
The troubleshooting method is mentioned above.
If the poster is nginx php-fpm, 502 from time to time is usually a PHP problem.
The principle is that the backend hangs when the nginx reverse proxy requests the php-fpm backend.
I posted the php-fpm.conf configuration of my server
1G local memory (Alibaba Cloud’s smallest ECS)
<code>listen = /tmp/php-cgi.sock listen.backlog = -1 listen.allowed_clients = 127.0.0.1 listen.owner = www listen.group = www listen.mode = 0666 user = www group = www pm = dynamic pm.max_children = 10 pm.start_servers = 2 pm.min_spare_servers = 1 pm.max_spare_servers = 6 request_terminate_timeout = 100 request_slowlog_timeout = 0 slowlog = var/log/slow.log</code>
The specific parameters depend on the host configuration of the host.
Solution to 502 bad gateway error in nginx php-fpm