获取Rook/Shiny页面用户的私有IP地址 [英] Getting the private ip address of an Rook/Shiny page user

查看:99
本文介绍了获取Rook/Shiny页面用户的私有IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Rook创建了一些Web应用程序,该应用程序侦听了端口8000上的网络ip(192.168.xx.xx).我办公室内的每个人都可以通过在浏览器中键入http://192.168.xx.xx:8000/page_name来连接到它们.我需要监视这些页面的使用情况,并想知道如何获取连接到这些页面的用户的网络IP地址.

I have created some web app using Rook which listen to my network ip (192.168.xx.xx) at port 8000. Everyone inside my office can connect to them just typing http://192.168.xx.xx:8000/page_name in the browser. I need to monitor these pages usage and wonder how I can get the network ip address of those connected to them.

我没有Web开发方面的经验,到目前为止,从完成的研究来看,似乎很难(几乎不可能)使用像JavaScript这样的客户端代码,(如果我错了,请纠正我).所以,我的问题是:有什么方法可以在Rook应用程序中使用服务器端代码来获取网络客户端ip? (如果需要,我愿意更改Web服务器,任何解决方案都值得赞赏).

I'm not experienced in web development and from the research done so far it seems that using client side code like JavaScript it's very difficult (almost impossible) to achieve that, (correct me if I'm wrong). So, my question is: is there any way of getting the network client ip using server side code inside an Rook application? (If needed I'd be willing to change the web server, any solution appreciated).

如果我的问题似乎令人困惑,请多谢,尤其是我不确定是否需要其他标签.

Thanks and sorry in advance should my question seem confusing... in particular I'm unsure if other tags are needed.

我也将接受使用与Rook不同的答案(但仍在R中)

I would also accept answers using something different than Rook (but still in R)

我已经按照链接.我正在配置服务器,以获取access_log,根据@Thell,该服务器包含我需要的信息.在shiny-server.conf中,我添加了相对语句,现在是:

EDIT 2: I have set Shiny Server following this link. I'm at step of configuring the Server in order to get the access_log that, according to @Thell, contains the information I need. In The shiny-server.conf I have added the relative statement and now is:

run_as shiny;

server {
  listen 3838;

  location / {
    site_dir /var/shiny-server/www;
    log_dir /var/shiny-server/log;
    directory_index on;
  }

}

access_log /home/michelec/log.txt;

最后一行应该告诉Shiny将access_log写入我的主文件夹.但是,什么都没有发生,日志仍为空白.根据此处,在格式部分,这些日志之一:

the last line should tell shiny to write the access_log into my home folder. Nothing happens however, the log remains blank. according to here, in the Formats section, I should receive one of these logs:

default ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"'
short ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms'
tiny ':method :url :status :res[content-length] - :response-time ms'
dev concise output colored by response status for development use

取决于您保留默认格式还是更改默认格式.

depending if you leave the default format or you change it.

推荐答案

似乎Rook仅在由rApache支持时才会提供远程添加.

It seems that Rook will only provide remote add when backed by rApache.

另一种选择是设置 shiny-服务器来自@ RStudio,然后

Another option would be to setup shiny-server from the fine folks @ RStudio and then configure the access log such that you'd be able to parse that using the selected access log format that you choose.

我倾向于使用Shiny解决方案,因为rApache的作者还帮助开发了Shiny and Shiny(因为它是RStudio的官方产品)似乎有望实现增长和长期可用性,我们

I'd lean toward the Shiny solution as the author of rApache also helped on Shiny and Shiny (being that it is an official product of RStudio) seems poised for growth and long term availability which we can't really say about rApache (as fine as it is!).

这篇关于获取Rook/Shiny页面用户的私有IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆