A 502 HTTP error is a generic error, so there is no clear cause.
In the case of Seafile however, it means most often that Seafile is simply not running, or not running on the ports specified in the nginx file.
Are you sure your Seafile is running on port 8000/8082? What’s your gunicorn.conf.py?
Lastly, there is a fully documented nginx file in the Seafile manual at HTTPS with Nginx - Seafile Admin Manual. Why don’t you simply compare your nginx file with the one in the official documentation? (You’ll see that your configuration can be stripped down a LOT!)