[LINUX] [AWS x WordPress] 504 Gateway Time-out came out

Introduction

I was using WordPress on AWS (AWS Linux instance), but one day suddenly 504 Gateway Time-out came out. スクリーンショット 2020-07-31 8.31.56.png

504 Gateway Time-out Meaning

[Wikipedia](https://ja.wikipedia.org/wiki/HTTP%E3%82%B9%E3%83%86%E3%83%BC%E3%82%BF%E3%82%B9%E3% According to 82% B3% E3% 83% BC% E3% 83% 89), 5XX refers to a server error and 504 is "Gateway timeout. Gateway proxy server does not have a proper response from the server inferred from the URI. It means "timed out." It seems to be a problem on AWS because it is an error on the server side.

Try various things

Tried ① [What to do when "504 gateway timeout" occurs frequently in WordPress built on AWS](https://qiita.com/kimurayut/items/566f4de4075b075d549d) It is said that the target group of ALB was changed from http & https to http, but it was originally http.

Tried ② [[504 Gateway Time-out] [Bad Request] does not connect to the blog! Check AWS ELB](https://www.keitaiplan.com/aws-elb-504-gateway-time-out-bad-request/) It was said that I could access it by typing the DNS name / IP address directly, but I couldn't do it this time.

Tried ③ [[WordPress] What to do when 504 Gateway Time-out appears](https://sho-d-blog.com/tech/589/)
$ df -h

It is said that you can check the storage capacity, but even if you look at the usage%, the ratio was not particularly high.

Tried ④ [[AWS] [WordPress] Cause of "504 Gateway Timeout Error"](https://sashihara.jp/aws-wordpress-504) It will check if Apache is running.
$ sudo systemctl status httpd.service

At this time, it was ʻActive: active (running)`, so I misunderstood that it was not a problem on the Apache side, but this was a mistake.

solution

$ sudo systemctl restart httpd.service

This time Apahce seems to have fallen before I knew it, so I restarted Apache with the above command, the 504 error was resolved and the WordPress screen was displayed. Even if you check the status, it seems that it may not be reflected well sometimes, so it is more reliable to check whether the process is started properly with the ps command.

Reflections

I searched for an online article and tried it as soon as I could, but I should have isolated the problem a little more as shown in the article below.

[People who are not good at infrastructure should know the failure patterns and solutions that do not lead to websites] (https://qiita.com/ykyk1218/items/5a541246e82678b2ece3)

It may be faster to google, but I would like to confirm the cause after predicting the cause with logs etc. in order to improve the infrastructure power.

Recommended Posts

[AWS x WordPress] 504 Gateway Time-out came out