常规配置
upstream apixxx {
server 内网ip1:8003;
server 内网ip2:8003;
}
location /r/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 30;
proxy_pass http://apixxx/;
}
# actuator 仅本机
location ^~ /r/actuator/ {
allow 允许访问的ip地址;
allow 127.0.0.1;
allow ::1;
deny all;
proxy_pass http://apixxx/;
}微信公众号验证文件
location /xXOZol3OZt.txt {
return 200 'c291f50a71cd78ce2040893916766647';
}配置访问log文件
- 在nginx.conf中配置.
location /logs {
alias /path/to/logs;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}- 在mine.types中添加
text/plain log;排除爬虫请求
Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)
if ($http_user_agent ~* "CensysInspect") {
return 403;
}网站直接简单的用户名/密码才能访问
echo -n '用户名:你的密码' | base64 if ($http_authorization != "Basic 生成出来的base64") {
add_header WWW-Authenticate 'Basic realm="Kibana Login"' always;
return 401;
}作者:张三 创建时间:2026-02-28 15:23
最后编辑:张三 更新时间:2026-06-08 18:03
最后编辑:张三 更新时间:2026-06-08 18:03