Is it possible to use a remote file to store servernames? server_name $somevariable-file?

I need to add a lot of sub-domains to a configuration file as users
register on our website our script needs to add the sub-domain. Is it
possible to use a variable or function in the config file so it loads a
remote file which has sub-domains listed one per line? It would be
easier for our developers to add a sub-domain one per line into a file.
Then trying to add them into the configuration file directly.

server_name $some-function;

Posted at Nginx Forum:

On Mon, Nov 28, 2011 at 05:44:32AM -0500, anagio wrote:

I need to add a lot of sub-domains to a configuration file as users
register on our website our script needs to add the sub-domain. Is it
possible to use a variable or function in the config file so it loads a
remote file which has sub-domains listed one per line? It would be
easier for our developers to add a sub-domain one per line into a file.
Then trying to add them into the configuration file directly.

server_name $some-function;

http://nginx.org/en/docs/ngx_core_module.html#include

Isn’t include only for nginx.conf file? How would I add this to the
sites-available/server file to include a remote file with list of
sub-domains?

Posted at Nginx Forum:

On Mon, Nov 28, 2011 at 06:52:59AM -0500, anagio wrote:

Isn’t include only for nginx.conf file? How would I add this to the
sites-available/server file to include a remote file with list of
sub-domains?

You can rsync/scp/curl/whatever the file in your preferable
format (with server names one per line), then generate an
nginx.conf syntax-compliant file with “server_name XXX;”
lines, then send the HUP signal (for details, please see
Controlling nginx) to the master nginx
process, and have it update the configuration on the fly.
It’s all pretty easy to achieve, and doesn’t require adding
the “fetching” functionality to nginx.