504 gateway timeout while runnning the Load Test jmeter

I am running the login api with 500 concurrent users from jmeter

I get below error

Response code: 504
Response message: Gateway Time-out

My nginx file is as shown below do I need to change this?

https://drive.google.com/file/d/1_XWYeqSAWZz6dtnTTCeLOEMzDwvEWwY1/view?usp=sharing

Generally speaking, a gateway timeout means that the server that is behind your NGINX proxy (in this case, Mattermost), is not responding to proxied requests within a reasonable amount of time.

Does the timeout only occur when your load test is running? If so, my guess is that your hardware/software configuration cannot support 500 simultaneous users. If you also see the timeout when the load tests are not running, then your NGINX config could be to blame.