In terms of 5XX errors, always check the web server log for further insights. Bad gateway would likely mean that some vhost config is targeting the wrong listeners in the backend.
gitlab-ctl check-config
should also provides hints whether the config is correct.
Also, please share your full config e.g. with
grep "^[^#;]" /etc/gitlab/gitlab.rb
On a related note - I’d suggest installing GitLab in a dedicated VM or Docker container, and not directly on localhost. There you can take snapshots of working versions and don’t pollute your desktop environment. Also, it allows to assign DNS/FQDN better.
Cheers,
Michael