502 Bad Gateway
nginx
2017-02-20 14:26:52 Error 31.16.XXX 32327#0: *696 connect() failed (111: Connection refused) while connecting to upstream nginx-error
2017-02-20 14:26:53 Error 31.16.XXX 32327#0: *696 connect() failed (111: Connection refused) while connecting to upstream nginx-error
2017-02-20 14:26:53 Error 31.16.XXX 32327#0: *696 connect() failed (111: Connection refused) while connecting to upstream nginx-error
2017-02-20 14:26:53 Error 31.16.XXX 32327#0: *696 connect() failed (111: Connection refused) while connecting to upstream nginx-error
[ 2017-02-20 14:32:34.5627 880/7f2d935ca700 Ser/Server.h:464 ]: [UstRouter] Shutdown finished
[ 2017-02-20 14:32:34.5627 880/7f2d92dc9700 Ser/Server.h:817 ]: [UstRouterApiServer] Freed 0 spare client objects
[ 2017-02-20 14:32:34.5627 880/7f2d92dc9700 Ser/Server.h:464 ]: [UstRouterApiServer] Shutdown finished
[ 2017-02-20 14:32:34.5628 871/7f260f7fe700 Ser/Server.h:817 ]: [ApiServer] Freed 0 spare client objects
[ 2017-02-20 14:32:34.5628 871/7f260f7fe700 Ser/Server.h:464 ]: [ApiServer] Shutdown finished
[ 2017-02-20 14:32:34.5629 871/7f264b7fe700 Ser/Server.h:817 ]: [ServerThr.2] Freed 128 spare client objects
[ 2017-02-20 14:32:34.5629 871/7f264b7fe700 Ser/Server.h:464 ]: [ServerThr.2] Shutdown finished
[ 2017-02-20 14:32:34.5629 871/7f264a7fc700 Ser/Server.h:817 ]: [ServerThr.4] Freed 128 spare client objects
[ 2017-02-20 14:32:34.5629 871/7f264a7fc700 Ser/Server.h:464 ]: [ServerThr.4] Shutdown finished
[ 2017-02-20 14:32:34.5630 871/7f2648ff9700 Ser/Server.h:817 ]: [ServerThr.7] Freed 128 spare client objects
[ 2017-02-20 14:32:34.5630 871/7f26497fa700 Ser/Server.h:817 ]: [ServerThr.6] Freed 128 spare client objects
[ 2017-02-20 14:32:34.5630 871/7f2648ff9700 Ser/Server.h:464 ]: [ServerThr.7] Shutdown finished
[ 2017-02-20 14:32:34.5630 871/7f26497fa700 Ser/Server.h:464 ]: [ServerThr.6] Shutdown finished
[ 2017-02-20 14:32:34.5630 871/7f2649ffb700 Ser/Server.h:817 ]: [ServerThr.5] Freed 128 spare client objects
[ 2017-02-20 14:32:34.5630 871/7f2649ffb700 Ser/Server.h:464 ]: [ServerThr.5] Shutdown finished
[ 2017-02-20 14:32:34.5630 871/7f260ffff700 Ser/Server.h:817 ]: [ServerThr.8] Freed 128 spare client objects
[ 2017-02-20 14:32:34.5630 871/7f260ffff700 Ser/Server.h:464 ]: [ServerThr.8] Shutdown finished
[ 2017-02-20 14:32:34.5630 871/7f264affd700 Ser/Server.h:817 ]: [ServerThr.3] Freed 128 spare client objects
[ 2017-02-20 14:32:34.5630 871/7f264affd700 Ser/Server.h:464 ]: [ServerThr.3] Shutdown finished
[ 2017-02-20 14:32:34.5631 871/7f264bfff700 Ser/Server.h:817 ]: [ServerThr.1] Freed 128 spare client objects
[ 2017-02-20 14:32:34.5631 871/7f264bfff700 Ser/Server.h:464 ]: [ServerThr.1] Shutdown finished
[ 2017-02-20 14:32:34.5633 880/7f2d98eb2780 age/Ust/UstRouterMain.cpp:523 ]: Passenger UstRouter shutdown finished
[ 2017-02-20 14:32:34.5719 1339/7f249a3a3780 age/Wat/WatchdogMain.cpp:1291 ]: Starting Passenger watchdog...
[ 2017-02-20 14:32:34.5772 1342/7fd235c10780 age/Cor/CoreMain.cpp:982 ]: Starting Passenger core...
[ 2017-02-20 14:32:34.5773 1342/7fd235c10780 age/Cor/CoreMain.cpp:235 ]: Passenger core running in multi-application mode.
[ 2017-02-20 14:32:34.5985 1342/7fd235c10780 age/Cor/CoreMain.cpp:732 ]: Passenger core online, PID 1342
[ 2017-02-20 14:32:34.6046 1351/7f46d4a4f780 age/Ust/UstRouterMain.cpp:529 ]: Starting Passenger UstRouter...
[ 2017-02-20 14:32:34.6050 1351/7f46d4a4f780 age/Ust/UstRouterMain.cpp:342 ]: Passenger UstRouter online, PID 1351
[ 2017-02-20 14:32:34.6653 871/7f265e341780 age/Cor/CoreMain.cpp:967 ]: Passenger core shutdown finished
Feb 20 14:37:59 srv-02 systemd[1]: Stopping LSB: Apache2 web server...
Feb 20 14:38:03 srv-02 apache2[2216]: Stopping web server: apache2.
Feb 20 14:38:03 srv-02 systemd[1]: Stopped LSB: Apache2 web server.
Feb 20 14:38:04 srv-02 systemd[1]: Starting LSB: Apache2 web server...
Feb 20 14:38:04 srv-02 systemd[1]: Failed to reset devices.list on /system.slice/apache2.service: Operation not permitted
Feb 20 14:38:06 srv-02 apache2[2297]: Starting web server: apache2.
Feb 20 14:38:06 srv-02 systemd[1]: Started LSB: Apache2 web server.
Feb 20 14:38:06 srv-02 systemd[1]: Reloading Startup script for nginx service.
Feb 20 14:38:06 srv-02 nginx[2491]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Feb 20 14:38:06 srv-02 nginx[2491]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Feb 20 14:38:06 srv-02 systemd[1]: Reloaded Startup script for nginx service.
[Mon Feb 20 14:56:25.619696 2017] [mpm_prefork:notice] [pid 4549] AH00169: caught SIGTERM, shutting down
[ 2017-02-20 14:56:25.6411 4561/7fea71dc6700 age/Cor/CoreMain.cpp:532 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ 2017-02-20 14:56:25.6411 4570/7f1a43fff700 age/Ust/UstRouterMain.cpp:422 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ 2017-02-20 14:56:25.6412 4561/7fea779b8780 age/Cor/CoreMain.cpp:901 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2017-02-20 14:56:25.6412 4570/7f1a4fbdf780 age/Ust/UstRouterMain.cpp:492 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2017-02-20 14:56:25.6412 4570/7f1a43fff700 Ser/Server.h:464 ]: [UstRouter] Shutdown finished
[ 2017-02-20 14:56:25.6412 4570/7f1a4a2f7700 Ser/Server.h:817 ]: [UstRouterApiServer] Freed 0 spare client objects
[ 2017-02-20 14:56:25.6413 4570/7f1a4a2f7700 Ser/Server.h:464 ]: [UstRouterApiServer] Shutdown finished
[ 2017-02-20 14:56:25.6415 4570/7f1a4fbdf780 age/Ust/UstRouterMain.cpp:523 ]: Passenger UstRouter shutdown finished
[ 2017-02-20 14:56:25.6415 4561/7fea70cc2700 Ser/Server.h:817 ]: [ServerThr.3] Freed 128 spare client objects
[ 2017-02-20 14:56:25.6415 4561/7fea4bfff700 Ser/Server.h:817 ]: [ServerThr.4] Freed 128 spare client objects
[ 2017-02-20 14:56:25.6415 4561/7fea70cc2700 Ser/Server.h:464 ]: [ServerThr.3] Shutdown finished
[ 2017-02-20 14:56:25.6415 4561/7fea4bfff700 Ser/Server.h:464 ]: [ServerThr.4] Shutdown finished
[ 2017-02-20 14:56:25.6416 4561/7fea497fa700 Ser/Server.h:817 ]: [ApiServer] Freed 0 spare client objects
[ 2017-02-20 14:56:25.6416 4561/7fea497fa700 Ser/Server.h:464 ]: [ApiServer] Shutdown finished
[ 2017-02-20 14:56:25.6416 4561/7fea4affd700 Ser/Server.h:817 ]: [ServerThr.6] Freed 128 spare client objects
[ 2017-02-20 14:56:25.6416 4561/7fea4affd700 Ser/Server.h:464 ]: [ServerThr.6] Shutdown finished
[ 2017-02-20 14:56:25.6416 4561/7fea4b7fe700 Ser/Server.h:817 ]: [ServerThr.5] Freed 128 spare client objects
[ 2017-02-20 14:56:25.6416 4561/7fea4b7fe700 Ser/Server.h:464 ]: [ServerThr.5] Shutdown finished
[ 2017-02-20 14:56:25.6416 4561/7fea4a7fc700 Ser/Server.h:817 ]: [ServerThr.7] Freed 128 spare client objects
[ 2017-02-20 14:56:25.6417 4561/7fea71544700 Ser/Server.h:817 ]: [ServerThr.2] Freed 128 spare client objects
[ 2017-02-20 14:56:25.6417 4561/7fea4a7fc700 Ser/Server.h:464 ]: [ServerThr.7] Shutdown finished
[ 2017-02-20 14:56:25.6417 4561/7fea71544700 Ser/Server.h:464 ]: [ServerThr.2] Shutdown finished
[ 2017-02-20 14:56:25.6417 4561/7fea71dc6700 Ser/Server.h:817 ]: [ServerThr.1] Freed 128 spare client objects
[ 2017-02-20 14:56:25.6417 4561/7fea49ffb700 Ser/Server.h:817 ]: [ServerThr.8] Freed 128 spare client objects
[ 2017-02-20 14:56:25.6417 4561/7fea71dc6700 Ser/Server.h:464 ]: [ServerThr.1] Shutdown finished
[ 2017-02-20 14:56:25.6417 4561/7fea49ffb700 Ser/Server.h:464 ]: [ServerThr.8] Shutdown finished
[ 2017-02-20 14:56:25.7450 4561/7fea779b8780 age/Cor/CoreMain.cpp:967 ]: Passenger core shutdown finished
I am not sure about a final solution, but I suggest to try changing Apache to graceful restarts to rule out issues with Plesk restarting Apache:
https://support.plesk.com/hc/en-us/articles/213907285-How-to-enable-Apache-graceful-restart-in-Plesk
The 502 in Nginx is caused by a temporary unavailability of httpd service. This can happen when Apache is "restarted" instead of only "reloading" its configuration. When you change to graceful restarts, httpd will not really "restart", but only reload the configuration, leaving httpd processes intact. This will likely avoid a 502.
Or have another user on here with better OS knowledge to solve this case