nginx template updates and bot blocking included by default
This commit is contained in:
parent
9f79067159
commit
dbb1872f2b
14 changed files with 90 additions and 2 deletions
|
@ -983,13 +983,26 @@ function genFixes(){
|
|||
echo -e "Include /var/www/new/ehcp/apachehcp_globalpanelurls.conf" >> "/etc/apache2/apache2.conf"
|
||||
fi
|
||||
fi
|
||||
# Same thing for nginx
|
||||
|
||||
# Same thing for nginx (plus bad bot and ip blocker)
|
||||
if [ -e "/etc/nginx/nginx.conf" ]; then
|
||||
hasEHCPPanelConf=$(cat "/etc/nginx/nginx.conf" | grep -o "apachehcp_globalpanelurls.conf")
|
||||
if [ -z "$hasEHCPPanelConf" ]; then
|
||||
# Put it one line before close pattern
|
||||
sed -i '$i \include /var/www/new/ehcp/apachehcp_globalpanelurls.conf;' "/etc/nginx/nginx.conf"
|
||||
fi
|
||||
|
||||
hasBlackList=$(cat "/etc/nginx/nginx.conf" | grep -o "blacklist.conf")
|
||||
if [ -z "$hasBlackList" ]; then
|
||||
# Put it one line before close pattern
|
||||
sed -i '$i \include nginx-badbot-blocker/blacklist.conf;' "/etc/nginx/nginx.conf"
|
||||
fi
|
||||
|
||||
hasBlockIPList=$(cat "/etc/nginx/nginx.conf" | grep -o "blockips.conf")
|
||||
if [ -z "$hasBlockIPList" ]; then
|
||||
# Put it one line before close pattern
|
||||
sed -i '$i \include nginx-badbot-blocker/blockips.conf;' "/etc/nginx/nginx.conf"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Change to .conf
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
location ^~ /{protected_directory_path}/ {
|
||||
root {homedir}/httpdocs;
|
||||
try_files $uri $uri/ /{protected_directory_path}/index.php?$args;
|
||||
auth_basic "Restricted Area";
|
||||
auth_basic_user_file {protected_directory_credentials_file};
|
||||
location ~ ^/{protected_directory_path}/(.+\.php)$ {
|
||||
try_files $uri =404;
|
||||
try_files $uri $uri/ /{protected_directory_path}/index.php?$args;
|
||||
root {homedir}/httpdocs;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_index index.php;
|
||||
|
|
|
@ -12,9 +12,14 @@ server {
|
|||
|
||||
root {homedir};
|
||||
index index.html index.htm index.php;
|
||||
|
||||
if ($bad_bot) { return 444; }
|
||||
if ($bad_referer) { return 403; }
|
||||
|
||||
location / {
|
||||
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 495 496 497 500 501 502 503 504 505 506 507 /error_page.html;
|
||||
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
|
|
|
@ -13,11 +13,16 @@ server {
|
|||
error_log {homedir}/logs/error_log;
|
||||
|
||||
index index.html index.htm index.php;
|
||||
|
||||
if ($bad_bot) { return 444; }
|
||||
if ($bad_referer) { return 403; }
|
||||
|
||||
location / {
|
||||
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 495 496 497 500 501 502 503 504 505 506 507 /error_page.html;
|
||||
|
||||
{root_password_protected_dirs}
|
||||
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
|
|
|
@ -49,4 +49,10 @@ http {
|
|||
include /var/www/new/ehcp/apachehcp.conf;
|
||||
include /var/www/new/ehcp/apachehcp_subdomains.conf;
|
||||
include /var/www/new/ehcp/apachehcp_globalpanelurls.conf;
|
||||
|
||||
##########################
|
||||
# Nginx Bad Bot Blocker #
|
||||
##########################
|
||||
include nginx-badbot-blocker/blacklist.conf;
|
||||
include nginx-badbot-blocker/blockips.conf;
|
||||
}
|
||||
|
|
|
@ -12,9 +12,14 @@ server {
|
|||
|
||||
root {homedir};
|
||||
index index.html index.htm index.php;
|
||||
|
||||
if ($bad_bot) { return 444; }
|
||||
if ($bad_referer) { return 403; }
|
||||
|
||||
location / {
|
||||
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 495 496 497 500 501 502 503 504 505 506 507 /error_page.html;
|
||||
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
|
|
|
@ -13,11 +13,16 @@ server {
|
|||
error_log {homedir}/logs/error_log;
|
||||
|
||||
index index.html index.htm index.php;
|
||||
|
||||
if ($bad_bot) { return 444; }
|
||||
if ($bad_referer) { return 403; }
|
||||
|
||||
location / {
|
||||
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 495 496 497 500 501 502 503 504 505 506 507 /error_page.html;
|
||||
|
||||
{root_password_protected_dirs}
|
||||
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
|
|
|
@ -49,4 +49,10 @@ http {
|
|||
include /var/www/new/ehcp/apachehcp.conf;
|
||||
include /var/www/new/ehcp/apachehcp_subdomains.conf;
|
||||
include /var/www/new/ehcp/apachehcp_globalpanelurls.conf;
|
||||
|
||||
##########################
|
||||
# Nginx Bad Bot Blocker #
|
||||
##########################
|
||||
include nginx-badbot-blocker/blacklist.conf;
|
||||
include nginx-badbot-blocker/blockips.conf;
|
||||
}
|
||||
|
|
|
@ -12,9 +12,14 @@ server {
|
|||
|
||||
root {homedir};
|
||||
index index.html index.htm index.php;
|
||||
|
||||
if ($bad_bot) { return 444; }
|
||||
if ($bad_referer) { return 403; }
|
||||
|
||||
location / {
|
||||
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 495 496 497 500 501 502 503 504 505 506 507 /error_page.html;
|
||||
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
|
@ -54,9 +59,14 @@ server {
|
|||
|
||||
root {homedir};
|
||||
index index.html index.htm index.php;
|
||||
|
||||
if ($bad_bot) { return 444; }
|
||||
if ($bad_referer) { return 403; }
|
||||
|
||||
location / {
|
||||
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 495 496 497 500 501 502 503 504 505 506 507 /error_page.html;
|
||||
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
|
|
|
@ -13,11 +13,16 @@ server {
|
|||
error_log {homedir}/logs/error_log;
|
||||
|
||||
index index.html index.htm index.php;
|
||||
|
||||
if ($bad_bot) { return 444; }
|
||||
if ($bad_referer) { return 403; }
|
||||
|
||||
location / {
|
||||
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 495 496 497 500 501 502 503 504 505 506 507 /error_page.html;
|
||||
|
||||
{root_password_protected_dirs}
|
||||
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
|
@ -166,11 +171,16 @@ server {
|
|||
error_log {homedir}/logs/error_log;
|
||||
|
||||
index index.html index.htm index.php;
|
||||
|
||||
if ($bad_bot) { return 444; }
|
||||
if ($bad_referer) { return 403; }
|
||||
|
||||
location / {
|
||||
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 495 496 497 500 501 502 503 504 505 506 507 /error_page.html;
|
||||
|
||||
{root_password_protected_dirs}
|
||||
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
|
|
|
@ -48,4 +48,10 @@ http {
|
|||
include /var/www/new/ehcp/apachehcp.conf;
|
||||
include /var/www/new/ehcp/apachehcp_subdomains.conf;
|
||||
include /var/www/new/ehcp/apachehcp_globalpanelurls.conf;
|
||||
|
||||
##########################
|
||||
# Nginx Bad Bot Blocker #
|
||||
##########################
|
||||
include nginx-badbot-blocker/blacklist.conf;
|
||||
include nginx-badbot-blocker/blockips.conf;
|
||||
}
|
||||
|
|
|
@ -17,9 +17,14 @@ server {
|
|||
|
||||
root {homedir};
|
||||
index index.html index.htm index.php;
|
||||
|
||||
if ($bad_bot) { return 444; }
|
||||
if ($bad_referer) { return 403; }
|
||||
|
||||
location / {
|
||||
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 495 496 497 500 501 502 503 504 505 506 507 /error_page.html;
|
||||
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
|
|
|
@ -19,11 +19,16 @@ server {
|
|||
error_log {homedir}/logs/error_log;
|
||||
|
||||
index index.html index.htm index.php;
|
||||
|
||||
if ($bad_bot) { return 444; }
|
||||
if ($bad_referer) { return 403; }
|
||||
|
||||
location / {
|
||||
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 495 496 497 500 501 502 503 504 505 506 507 /error_page.html;
|
||||
|
||||
{root_password_protected_dirs}
|
||||
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
|
|
|
@ -48,4 +48,10 @@ http {
|
|||
include /var/www/new/ehcp/apachehcp.conf;
|
||||
include /var/www/new/ehcp/apachehcp_subdomains.conf;
|
||||
include /var/www/new/ehcp/apachehcp_globalpanelurls.conf;
|
||||
|
||||
##########################
|
||||
# Nginx Bad Bot Blocker #
|
||||
##########################
|
||||
include nginx-badbot-blocker/blacklist.conf;
|
||||
include nginx-badbot-blocker/blockips.conf;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue