Nginx configuration file automatically resets itself if a user is created

I successfully installed MIAB and it functions well. I subtly modified the nginx configuration file located at /etc/nginx/conf.d/local.conf by doing a reverse redirection, in that I hate URL formats like and I desperately need a “www” added before The modification works fine until I add a new user. Whenever I add a new user, the ‘local.conf’ resets itself to the original copy, and all my modifications disappeared, that I have to suffer from the terrible ‘’ type URL. I am wondering how can I prevent this local.conf from automatically resets, or is there any other ways to do this redirection?

You may add

chattr +i /etc/nginx/conf.d/local.conf

however I do not recommend this as it would block any modifications to the config.

Instead try adding your config in separate file, as whole /etc/nginx/conf.d/*.conf; is included in main nginx.conf config.

1 Like

An undocumented and unsupported feature is to create conf files per domain in /home/user-data/www/. So you would create the file:


After you make changes, you need to make nginx reload its config by running:

# /root/mailinabox/tools/web_update

Again: unsupported.