First, we can use “watch/monitor” files in linux for changes and execute
some command based on it.
Now, for a site lets put a “.nginxaccess” file to hold site specific
configuration (file will be writable by PHp, etc so web-site can update
it)
Then we can put in main site config “include $documentroot/.nginxaccess”
And also start a daemon to watch “/var/www/path/to/site/.nginxaccess”.
Whenever any changes are detected in
“/var/www/path/to/site/.nginxaccess” we
can test nginx config and reload it.
I will be giving this a try to see what issues I may face…
Please give your suggestions/opinion/alternative approach…
Goal is to allow wordpress like web-apps to update a site-specific nginx
config file AND have nginx auto-reloaded new config.
Posted at Nginx Forum: