If you face 502 error from gitlab server, it means that server is busy for doing something in most of cases. It might be associated with server performance.
Option 1. Wait for 5 minutes if your server is just booted
There are some kind of initialization process in Gitlab, so it may takes 2-5 mins usually, so you don't need to think that server is crashed or something wrong.
OPTION 2. Adjust Unicorn timeout or the number of workers
You can use the following settings in
sudo gitlab-ctl reconfigure for the change to take effect.