Tag Archives: Nginx 502Bad Gateway

[Solved] Nginx 502Bad Gateway: some static resources cannot be accessed

Scenario: Currently, there are several node services in ECs, using the forever process to guard. Recently, I opened the online page and found an error 502 bad gateway ; At the same time, some static resources cannot be accessed. (previously available)

Solution:
first view the log information of nginx, which is basically repeated as follows

2017/04/25 22:09:45 [warn] 25037#0: *12 an upstream response is buffered to a temporary file /usr/local/nginx/proxy_temp/3/00/0000000003 while reading upstream, client: 125.119.1.1, server: channel.zhaoleilei.cn, request: “GET /build/common.js HTTP/1.1”, upstream: “ http://127.0.1.1:2000/build/common.js “, host: “channel.zhaoleilei.cn”, referrer: “ http://channel.zhaoleilei.cn/login ”
2017/04/25 22:09:54 [info] 25037#0: *12 client prematurely closed connection while sending to client, client: 125.119.1.1, server: channel.zhaoleilei.cn, request: “GET /build/common.js HTTP/1.1”, upstream: “ http://127.0.1.1:2000/build/common.js “, host: “channel.zhaoleilei.cn”, referrer: “ http://channel.zhaoleilei.cn/login ”

Internet search for reasons, failed. Feel that the problem lies in nginx or forever; When opening nginx. Conf to try to modify the configuration, an error is found e514: write error (file system full?); Find the reason and say the disk is full. Check Ubuntu disk space and solve the problem with full processing method

 

Conclusion: the reason for this problem is that the temporary log of forever is too large, resulting in the disk full. Delete the log.

Expansion: do scheduled task log cutting, do compressed backup in days (which can be realized through script), keep it for a certain time for viewing, and do log analysis if necessary