location = /favicon.ico {
alias /var/www/html/favicon.ico;
}
error_page 500 502 503 504 400 403 404 /errors.html;
location = /errors.html {
alias /var/www/html/errors.html;
}
location ^~ /.well-known/acme-challenge/{
default_type "text/plain";
root /;
}
if ($http_user_agent ~* "MJ12bot|Scrapy|python|AhrefsBot|BLEXBot|DotBot|^$") {
return 403;
break;
}
gzip on;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png image/jpg;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_comp_level 6;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log info;
access_log /var/log/nginx/access_aka.log aka_logs;
mkdir -p /etc/nginx/conf.d/agent
wget --http-user=download@hscsec.cn --http-passwd=HSC2019 https://download.hscsec.cn/nginx/agent.conf -O /etc/nginx/conf.d/agent/agent.conf
wget --http-user=download@hscsec.cn --http-passwd=HSC2019 https://download.hscsec.cn/nginx/agent.conf -O /etc/nginx/conf.d/agent/agent.conf && nginx -t && systemctl restart nginx
include conf.d/agent/agent.conf;
log_format aka_logs
'{"@timestamp":"$time_iso8601",'
'"host":"$hostname",'
'"server_ip":"$server_addr",'
'"client_ip":"$remote_addr",'
'"xff":"$http_x_forwarded_for",'
'"domain":"$host",'
'"url":"$uri",'
'"referer":"$http_referer",'
'"args":"$args",'
'"upstreamtime":"$upstream_response_time",'
'"responsetime":"$request_time",'
'"request_method":"$request_method",'
'"status":"$status",'
'"size":"$body_bytes_sent",'
'"request_body":"$request_body",'
'"request_length":"$request_length",'
'"protocol":"$server_protocol",'
'"upstreamhost":"$upstream_addr",'
'"file_dir":"$request_filename",'
'"http_user_agent":"$http_user_agent"'
'}';