In my case, I was impatient and ended up misinterpreting the magazine.
In fact, the real problem was the connection between nginx and uwsgi, and not between the browser and nginx. If I downloaded the site into my browser and waited a long time, I would get "504 - Bad Gateway". But it took so long that I kept trying things and then updated in the browser. Therefore, I never waited long enough to see error 504. When updating in a browser, that is, when the previous request is closed, and Nginx writes this to the log as 499.
development
Here I will assume that the reader knows how I, how I, when I started playing.
My installation was a reverse proxy, nginx server and application server, uWSGI server. All the request from the client will be sent to the nginx server, and then redirected to the uWSGI server, and then the response is sent back as well. I think everyone is using nginx / uwsgi and should use it.
My nginx worked as it should, but something was wrong with the uwsgi server. There are two ways (possibly more) in which the uwsgi server may not respond to the nginx server.
1) uWSGI says: "I am processing, just wait and you will get an answer soon." nginx has a certain period of time that it is ready to wait, fx 20 seconds. After that, he will answer the client with a 504 error.
2) uWSGI is dead, or uWSGi is dying while nginx is waiting for it. nginx sees this immediately, in which case it returns error 499.
I tested my setup by making requests in the client (browser). Nothing happened in the browser, it just kept hanging. After 10 seconds (less than a timeout), I came to the conclusion that something was wrong (which was true) and closed the uWSGI server from the command line. Then I go to the uWSGI settings, try something new, and then restart the uWSGI server. At that moment, when I closed the uWSGI server, the nginx server will return error 499.
Therefore, I continued to debug using 499 erroe, which means a Google search for error 499. But if I waited long enough, I would get error 504. If I got error 504, I would better understand the problem and then be able to debug.
So the conclusion is that the problem was that uWGSI, which kept drooping ("Wait a bit, a little longer, then I will have an answer for you ...").
How I fixed this problem, I do not remember. I think this can be caused by many things.