The file you are modifying is replaced at every restart by the original configuration from the snap so you can’t do it out of the box.
The snap is a readonly filesystem so you can’t modify it. However on the web there are some instructions to unpack, modify what you need and repack the snap. The file you need to modify in the snap is at /usr/share/maas/nginx/nginx.conf. Of course as soon as you upgrade to a new version and you change your snap you’ll lose your patches
I have seen similar solutions online, but your suggested file doesn’t exist or the nginx directory. I tried a similar solution to yours but don’t see it applied.
I tried to add /usr/share/maas/nginx/nginx.conf, but I don’t see any change.