# Include\_shell

**URL:** <https://www.ruby-forum.com/t/include-shell/210945>\
**Category:** NGINX\
**Created:** [August 21, 2011, 9:16pm UTC](https://www.ruby-forum.com/t/include-shell/210945 "2011-08-21T21:16:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [August 21, 2011, 9:16pm UTC](https://www.ruby-forum.com/t/include-shell/210945/1 "2011-08-21T21:16:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Alistair\_Prestidge](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3be4f8/32.png) [@Alistair\_Prestidge](https://www.ruby-forum.com/u/Alistair_Prestidge)\
**Post date:** [August 22, 2011, 12:02am UTC](https://www.ruby-forum.com/t/include-shell/210945/2 "2011-08-22T00:02:36Z")

</div>

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:

> **[Re: include\_shell](https://forum.nginx.org/read.php?2,214115,214117)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![Alistair\_Prestidge](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3be4f8/32.png) [@Alistair\_Prestidge](https://www.ruby-forum.com/u/Alistair_Prestidge)\
**Post date:** [August 22, 2011, 12:38am UTC](https://www.ruby-forum.com/t/include-shell/210945/3 "2011-08-22T00:38:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Alistair\_Prestidge](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3be4f8/32.png) [@Alistair\_Prestidge](https://www.ruby-forum.com/u/Alistair_Prestidge)\
**Post date:** [August 23, 2011, 4:56pm UTC](https://www.ruby-forum.com/t/include-shell/210945/4 "2011-08-23T16:56:37Z")

</div>

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

> include\_shell  
> /var/www/site.com/site-nginx.conf[http://site.com/site-nginx.conf](http://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

---

<div class="post-metadata">

**Author:** ![Alistair\_Prestidge](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3be4f8/32.png) [@Alistair\_Prestidge](https://www.ruby-forum.com/u/Alistair_Prestidge)\
**Post date:** [August 23, 2011, 4:33pm UTC](https://www.ruby-forum.com/t/include-shell/210945/5 "2011-08-23T16:33:06Z")

</div>

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. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > implemented? are there any feature plans to implement this?
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\__ **\*\*** _  
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

[mailman.nginx.org archive](http://mailman.nginx.org/**mailman/listinfo/nginx)[http://mailman.nginx.org/mailman/listinfo/nginx](http://mailman.nginx.org/mailman/listinfo/nginx)

> 

–  
\*  
Thanks

Alistair Prestidge\*

- 
-
