Php 如何保护/netdata或netdata for Laravel?
我跟在后面。基本上,它正在打开用于Netdata的端口1999,并将其重定向到Php 如何保护/netdata或netdata for Laravel?,php,laravel,networking,netdata,Php,Laravel,Networking,Netdata,我跟在后面。基本上,它正在打开用于Netdata的端口1999,并将其重定向到/Netdata目录 location = /netdata { return 301 /netdata/; } location ~ /netdata/(?<ndpath>.*) { proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $host; proxy_set_
/Netdata
目录
location = /netdata {
return 301 /netdata/;
}
location ~ /netdata/(?<ndpath>.*) {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_pass_request_headers on;
proxy_set_header Connection "keep-alive";
proxy_store off;
proxy_pass http://netdata/$ndpath$is_args$args;
gzip on;
gzip_proxied any;
gzip_types *;
}
我已经定义了一个
auth
中间件,我如何只允许通过auth
中间件的人访问/netdata
路由?指南建议只将其限制为一个IP地址,但这是不可能的,因为我经常移动。虽然我没有使用Laravel或Forge的经验,但根据本文,您必须在中间件中定义该功能。本质上,您指示中间件仅在认证成功的情况下执行重定向
也许您可以指示Laravel将所有连接(如果验证成功)重定向到NGINX端点(/netdata),您将配置为仅允许从localhost
。因此,用户将无法访问/netdata
,除非他/她通过Laravel中间件进行身份验证,然后从该中间件重定向到Nginx服务器
upstream netdata {
server 127.0.0.1:19999;
keepalive 64;
}