Skip to content

Maps and auto reload nginx #9

rahul286 opened this Issue Oct 8, 2012 · 3 comments

3 participants

rahul286 commented Oct 8, 2012

basically when a nginx map file updates, user need to reload nginx server config.

normally using command: service nginx reload (on ubuntu)

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

rahul286 commented Oct 8, 2012

@MiteshShah Please check into this. visudo will help (I guess)

@MiteshShah MiteshShah was assigned Oct 10, 2012

Maps are not required for wordpress 3.6 onwards.

So closing this ticket as any more work on this will benefit legacy sites only.

@rahul286 rahul286 closed this Sep 30, 2013
@MiteshShah MiteshShah was unassigned by rahul286 Dec 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.