basically when a nginx map file updates, user need to reload nginx server config.
normally using command: service nginx reload (on ubuntu)
service nginx reload
above command needs sudo/root access so php with www-data can't run it out of the box....
Trick is, detect php-user - value of _SERVER["USER"]
assume it www-data
ask user to edit sudoers file so www-data can reload nginx config
they will add following line...
www-data ALL=NOPASSWD: nginx -t && service nginx reload
Then we will reload nginx config whenever we update map via PHP
<?php shell_exec('sudo nginx -t && service nginx reload'); ?>
There may be some mistake and some error checking in above
Get Mitesh involved as he is good at shell scripting
@MiteshShah Please check into this. visudo will help (I guess)
Maps are not required for wordpress 3.6 onwards.
So closing this ticket as any more work on this will benefit legacy sites only.