Could you share your app.yml (redact any passwords & sensitive info)
In the meantime, try
sudo systemctl stop nginx
Then try rebuilding?
From what I can see, You somehow have an external nginx running on this server. Unless you’ve configured it to reverse proxy discourse, this is the cause of your failed rebuild.