Parse server common error codes 500 501 502 503 504 505

  • 2020-06-15 10:31:25
  • OfStack

1:500 error

1, 500 Internal Server Error Internal service error: as the name implies, 500 error 1 is typically an unexpected situation that the server encounters and is unable to complete the request.

2. Possibility of 500 mistakes:

a, programming language syntax error, web script error

High concurrency, because of system resource constraints, and can not open too many files

3. General solutions:

a, check the error log file for nginx, php, to see what you can see

b, if it is too many open files, modify nginx worker_rlimit_nofile parameters, using the open file limit ulimit view system, modify/etc/security/limits conf, still appear too many open files, that is about to consider to do load balancing, to spread out flow to different servers

If the problem is with the script, you need to fix the script error and optimize the code

2:50; 2:504

1, 502 Bad Gateway error, 504 Bad Gateway timeout gateway timeout

2, the possibility of 502, 504

web server failure, insufficient program process

3, 1 general solution

Using nginx agent, the backend server fails; Or the number of ES65en-ES66en processes is not enough; php takes a long time to execute, or the ES68en-ES69en process dies. The use of fastCGI and so on will lead to errors of 502 and 504.

b, 502 means that the requested ES74en-ES75en has been executed, but for some reason it has not been completed, which ultimately results in the termination of the ES76en-ES77en process. Generally speaking, it is related to the setting of ES78en-ES79en.conf and the performance of php's execution program. The website has a large number of visits, while the number of PROCESSES of ES82en-ES83en is relatively small. For a 502 error in this case, simply increase the number of processes in ES84en-ES85en. Is any change/usr local/php/etc/php - fpm. conf files, including max_children values appropriately increased. This data will depend on the configuration of your server. Generally 1 ES95en-ES96en process accounts for 20M memory, you can calculate by yourself, the appropriate increase.

/ usr/local/php/sbin/php - fpm reload and then restart the 1.

c and 504 indicate timeout, that is, the request issued by the client did not reach the gateway, the request did not reach the executable ES110en-fpm. It is also related to the configuration of ES112en.conf.

The 501 server does not have the capability to complete the request. For example, the server might return this code if it does not recognize the request method.

The 503 server is currently unavailable (due to overload or downtime for maintenance). Usually, this is just a temporary state. (Service unavailable)

The version of HTTP protocol used in the request is not supported by the 505 server. (HTTP version not supported)


Related articles: