Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何保护/netdata或netdata for Laravel?_Php_Laravel_Networking_Netdata - Fatal编程技术网

Php 如何保护/netdata或netdata for Laravel?

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的端口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_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;
}