Welcome! Log In Create A New Profile

Advanced

Conditionally include conf files in ngin

Posted by Nikhita 
Conditionally include conf files in ngin
January 15, 2015 01:07PM
I have a conf file and I want to include it in nginx.conf only if it exists....how can that be done ?

Can we have an if statement before include ?
Re: Conditionally include conf files in ngin
January 04, 2018 10:09AM
Hi, you may use the include directive with some glob() pattern tricks

For instance, replace this

include /path/to/something/nonexisting.conf

with

include /path/to/something/nonexisting[.]conf

the config parser won't complain if such file does not exist.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 167
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready