loznfwu.sh
The IP's listed in this file will be given allow statements in the location / block(s) of the listed Nginx configuration file(s).
Example: config.conf
192.168.0.96
192.168.0.97
/etc/nginx/sites-available/siteone.com.conf
/etc/nginx/sites-available/sitetwo.com.conf
CONFIG_FILE="/your/path/config.conf"
Depending on how you are executing the script, leave sudo in or take it out.
- Backup original Nginx configuration in the same directory.
- Remove existing allow rules.
- Keeps existing deny rule(s) or writes new deny rule(s).
- Inserts the IP's with allow statements above the deny all line.
- Executes above for each Nginx configuration file.
- Reloads Nginx to apply the changes.