Include_shell

Hi

I am pretty new to nginx I have been searching around to find if there
is
a similar option like include_shell that lighttpd has
to use shell scripts to auto generate conf files.

It appears that there is no such option, I have searched the mailing
lists
and documentation. Is there a reason this has not been
implemented? are there any feature plans to implement this?

Alistair Prestidge

Nginx does not have the ability to execute anything and while I do not
know the roadmap for Nginx I highly doubt this is even a planned
feature. As far as I’m aware it’s intentionally done like this for
security reasons.

Posted at Nginx Forum:

On 21.08.2011 21:16, Alistair Prestidge wrote:

Hi

I am pretty new to nginx I have been searching around to find if there is
a similar option like include_shell that lighttpd has
to use shell scripts to auto generate conf files.

It appears that there is no such option, I have searched the mailing lists
and documentation. Is there a reason this has not been
implemented? are there any feature plans to implement this?

If you really need such feature I bet you can cover it with small shell
script along with a function to re-generate config before you start or
reload nginx.

I am curious about your usecase, where you may need such thing?

– Piotr.

On Tuesday 23 of August 2011 16:32:29 Alistair Prestidge wrote:

include_shell
/var/www/site.com/site-nginx.confhttp://site.com/site-nginx.conf

nginx.conf:

include “/path/to/special_generated.conf”

Then you can generate mentioned file using a script followed by nginx
reload.
If you don’t want to include it, just purge it using:

echo > “/path/to/special_generated.conf”

You can also use glob pattern, for example:
include “/path/to/special/*.conf”

Regards, Brane

My usecase is as follows

We have production, staging and several dev environments configured on
different machines and we add development environments on a semi regular
basis.

At the moment I have to create individual nginx conf files for each
environment. Which is not hard but can be time consuming even the
slightest
edit on one of the files means I have to go though
every config on every server and make the changes. Again not difficult
but
time consuming.

What I would Ideally like is one file. A bash file that I can commit to
my
code base.
This file can than figure out directory names and any specific config
settings that are needed for the specific environment.
For instance we set the following to be different depending on the
environment type.

fastcgi_param SITE_CONFIG dev;

If I could generate this all on the fly from a bash script I would only
ever
need to do

include_shell /var/www/site.com/site-nginx.conf

There would be no other setup for nginx. The bash script would handle
everything else any changes made to the script would just require a “svn
up”
followed by a reload.

Hope that makes sense.

Alistair

On 21 August 2011 23:37, Piotr K. [email protected] wrote:

implemented? are there any feature plans to implement this?

_____________**
nginx mailing list
[email protected]

http://mailman.nginx.org/**mailman/listinfo/nginxhttp://mailman.nginx.org/mailman/listinfo/nginx


*
Thanks

Alistair Prestidge*