Welcome! Log In Create A New Profile

Advanced

How to add a addtional .conf to nginx.conf

Posted by enginealt 
How to add a addtional .conf to nginx.conf
December 18, 2014 08:28AM
Hi guys,
I want to add a file call blacklist.conf into nginx.conf to block bad bot, how can I do it ? The blacklist.conf:

## Add here all user agents that are to be blocked.
map $http_user_agent $bad_bot {
default 0;
~*^Lynx 0; # Let Lynx go through
libwww-perl 1;
~*(?i)(httrack|htmlparser|libwww|JikeSpider|proximic|Sosospider|Baiduspider|msnbot|BBBike|WWWOFFLE|Widow|SuperHTTP|BlackWidow|HTTrack|^Custo|^AIBOT) 1;
}
## Add here all referrers that are to blocked.
map $http_referer $bad_referer {
default 0;
~(?i)(adult|babes|click|diamond|forsale|girl|jewelry|love|nudit|organic|poker|porn|poweroversoftware|sex|teen|webcam|zippo|casino|replica) 1;
}
## Add here all hosts that should be spared any referrer checking.
geo $bad_referer {
127.0.0.1 0;
192.168.1.0/24 0;
}
Re: How to add a addtional .conf to nginx.conf
December 18, 2014 09:29AM
include otherfile.conf;

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: How to add a addtional .conf to nginx.conf
December 18, 2014 10:00PM
So the other file.config will be locate in the same folder as nginx.conf, is that right? or I can place anyelse where?
Re: How to add a addtional .conf to nginx.conf
December 19, 2014 04:26AM
Yes, when no path is used it defaults to where nginx.conf is, and you can use a path as well.

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 236
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready