What is the problem if the website refreshes 502 after ten seconds? The server configuration is very high.

WBOY
Release: 2016-10-11 14:23:23
Original
2647 people have browsed it

CPU: 2 cores, Memory: 8192 MB, Bandwidth 10Mbps
Open the homepage of the website, hold down f5, keep refreshing and then get 502. Mysql is used on the external network, and mysql does not hang.
The other one has 2 cores, 2048 memory, and 2m bandwidth. I have never used lnmp, and the refresh will not kill it.
Has anyone encountered the same problem? Please give me some advice

ps: The environment that dies as soon as it is refreshed uses the lnmp installation package

Reply content:

CPU: 2 cores, Memory: 8192 MB, Bandwidth 10Mbps
Open the homepage of the website, hold down f5, keep refreshing and then get 502. Mysql is used on the external network, and mysql does not hang.
The other one has 2 cores, 2048 memory, and 2m bandwidth. I have never used lnmp, and the refresh will not kill it.
Has anyone encountered the same problem? Please give me some advice

ps: The environment that dies as soon as it is refreshed uses the lnmp installation package

HTTP Status 502 (Bad Gateway)
The server, acting as a gateway or proxy, received an invalid response from the upstream server.
Solution:

1. Improve the response speed of the Web server, that is, reduce the internal call relationship. You can cache the required pages, materials or data in the memory. It can be a dedicated cache server or the Web server's own cache to improve the response. Speed;

2. If there is a problem with network bandwidth, compress the transmitted data packets or apply to IDC to increase the bandwidth;

3. It is an internal network failure or setting problem, that is, internal network congestion, which may be caused by a large number of data calls or interactions internally, so the internal network transmission or protocol needs to be optimized;

4. The data reading in the database causes the front-end server to respond to user requests slowly, so the processing capacity of the database must be improved. If it is a read-only business, the data caching mode can be added or the database backup machine can be added to disperse the reading pressure

  • Look at nginx’s error.log log to see if there is any error message

  • nginx limits the maximum number of connections

  • Is the number of php-fpm connections exhausted? Optimize the php-fpm parameters

Is there a problem with your code? If there is an infinite loop in the code, or there is a very late memory operation, this kind of problem may occur

Exclusion method analysis steps:
1. Test with a static page
2. Test with a pure PHP script, not connected to cache, not connected to DB
3. Analyze the DB, cache and third-party services used in the backend one by one to see if they are normal.
The usual reason for 4 and 502 is that the fastcgi process has died for some reason. You can check the PHP-fpm log

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!