server {
server_name domain.tld domain.tld;
location / {
if ($http_user_agent ~ (^$|-|ApacheBench/2.3)$) {
return 444;
}
limit_req zone=req burst=3;
proxy_pass http://1.1.1.1:81;
proxy_redirect http://1.1.1.1:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location ~ ^/webmail(.*)$ { rewrite ^ https://domain.tld/webmail/ permanent;}
location ~ ^/myadmin(.*)$ { rewrite ^ https://domain.tld/myadmin/ permanent;}
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
root $root_path;
access_log /var/www/nginx-logs/domain isp;
access_log /var/www/httpd-logs/domain.tld.access.log ;
error_page 404 = @fallback;
}
location ~* ^/(webstat|awstats|webmail|myadmin|pgadmin)/ {
proxy_pass http://1.1.1.1:81;
proxy_redirect http://1.1.1.1:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location @fallback {
proxy_pass http://1.1.1.1:81;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location ^~ /webstat/ {
auth_basic "Restricted area";
auth_basic_user_file /var/www/domain/data/etc/5112100.passwd;
try_files $uri @fallback;
}
include /usr/local/ispmgr/etc/nginx.inc;
ssl_certificate /var/www/httpd-cert/domain/domain.chained.crt;
ssl_certificate_key /var/www/httpd-cert/domain/domain.key;
listen 1.1.1.1;
listen 1.1.1.1:443 ssl;
disable_symlinks if_not_owner from=$root_path;
set $root_path /var/www/domain/data/www/domain.tld;
}
}