If i remember i had the topic created for this years ago, i am not able to find it, i assume i posted it on github repo.
W3 total cache plugins create a nginx.conf file for all the cache settings however this not get included by default but also because of security issue as per i remember the answer.
is there any workaround or can i make the change if i am the only one using the vps?
is it possible to create a global variable to get the nginx.conf from all the sites? even it have different root path? something like this in a global .conf nginx file. include /home/$path/nginx.conf;
According to the docs (Core functionality) include can use * as a wildcard.
So, it seems like you could do (this is not safe for a shared hosting system!):
include /home/*/etc/nginx.conf
I haven’t tested this.
/etc is optional (it’s just where we put most user level config files), but you should never put anything you don’t want the world to see in public_html. Configuration files don’t belong there. You aren’t trying to show this config file to the world, you’re trying to have it parsed and acted on by one thing: nginx.
There are cases where PHP web applications do this for simplicity and ability to edit the files from withing the web app, but those permissions get locked down in that case…still suboptimal, and it’s better if you can refactor a bit to put config files and anything with secrets or other sensitive info outside the document root. It’s easy to make mistakes, do a bulk chmod or whatever, that makes something that should not be readable readable. That’s easily avoidable by just putting anything that doesn’t need to be in public_html anywhere other than public_html.