I use Apache acting as a reverse proxy so requests get forwarded to port 5000.
You need to make sure the following variable is set before the musicbrainz server is started.
I start the musicbrainz server from systemd and have a line to set this environment variable.
There is a proper way of running this with fastcgi but I could not get this working on my server.
A reverse proxy was easier for me to configure so I use that.