Before moving to docker swarm or kubernetes, I try something simple to balancing application by using nginx load balancer. But how to know if our setup working or not? In nginx there is easy way to check that
- Open your nginx load balancer config, add this line at the top
log_format upstreamlog '$server_name to: $upstream_addr {$request} '
'upstream_response_time $upstream_response_time'
' request_time $request_time';
-
Add
access_log /var/log/nginx/your-server-access.log upstreamlog;
at line server { … }Log File Location
-
Restart your nginx service & check your log
using tail -f
It’s work!