使用Ruby 2.2.4,Rails 4.2.5,Puma 2.15.3。
应用程序运行正常,但几周后,我收到Rails的“出错了”错误。检查nginx日志后,这是我得到的:
2016/12/21 19:44:08 [error] 1387#0: *1219594 connect() to unix:///home/deployer/apps/abc/shared/tmp/sockets/abc-puma.sock failed (111: Connection refused) while connecting to upstream, client: 180.76.15.135, server: app.abc.my, request: "GET / HTTP/1.1", upstream: "http://unix:///home/deployer/apps/abc/shared/tmp/sockets/abc-puma.sock:/", host: "app.abc.my"
2016/12/21 19:44:08 [info] 1387#0: *1219594 recv() failed (104: Connection reset by peer) while sending response to client, client: 180.76.15.135, server: app.abc.my, request: "GET / HTTP/1.1", upstream: "http://unix:///home/deployer/apps/abc/shared/tmp/sockets/abc-puma.sock/", host: "app.abc.my"
我必须重启的唯一方法是
然后它奏效了。
我检查了我的nginx和puma进程:
deployer@vps1497:~$ ps aux | grep nginx
deployer 1146 0.0 0.0 6456 836 pts/1 S+ 16:14 0:00 grep nginx
root 1386 0.0 0.0 31240 388 ? Ss Dec15 0:00 nginx: master process /usr/sbin/nginx
www-data 1387 0.0 0.0 32416 2344 ? S Dec15 5:53 nginx: worker process
www-data 1389 0.0 0.0 32384 2288 ? S Dec15 5:54 nginx: worker process
www-data 1390 0.0 0.0 32420 2280 ? S Dec15 5:56 nginx: worker process
www-data 1391 0.0 0.0 32380 2284 ? S Dec15 6:04 nginx: worker process
deployer@vps1497:/etc/nginx/sites-available$ ps aux | grep puma
deployer 791 0.0 2.2 749108 93724 ? Sl 15:54 0:01 puma 2.15.3 (unix:///home/deployer/apps/rra/shared/tmp/sockets/abc-puma.sock) [20160710155205]
deployer 1340 0.0 0.0 6456 840 pts/1 S+ 16:25 0:00 grep puma
出了什么问题?我在服务器上有4GB RAM,我只能通过首先删除puma socket来重启应用程序。