Do file/dir creation as the galaxy user.
Run nginx as www-data:galaxy.
Make rerooting optional.