无法远程连接到闪亮的服务器并使 R 应用程序正常工作 [英] Cannot connect remotely to shiny-server and get R app working properly

查看:79
本文介绍了无法远程连接到闪亮的服务器并使 R 应用程序正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经解决了这个问题.请阅读下面的答案

我已经使用 VirtualBox 在 Ubuntu 14.04.4 LTS 上安装了 Shiny-server.在我的路由器中转发端口 3838 并设置桥接网络,然后将静态 IP 分配给我的虚拟 Ubuntu 机器后,我能够从网络外部的计算机远程连接并可视化hello"示例应用程序页面,但是仅呈现 HTML 代码.

I have installed shiny-server on Ubuntu 14.04.4 LTS with VirtualBox. After forwarding port 3838 in my router and setting a bridged network, then assigning a static IP to my virtual Ubuntu machine, I am being able to connect remotely, from a computer outside from my network and visualize the "hello" example app page, but only the HTML code is rendered.

R 和 markdown iframe 都不起作用(连接被重置并且它们变灰).另一方面,我可以完美地从我的主机和访客机器本身浏览 hello 应用程序.

Both R and markdown iframes are not working (connection is reset and they are grayed). On the other hand, I can perfectly browse the hello application from both, my host computer of from the guest machine itself.

端口是开放的,我已经用远程计算机检查过了.我的主机在 Windows 10 上运行,并且我还配置了防火墙以允许 TCP/UDP 通过端口 3838 传入/传出流量.

The ports are open, I have checked it with a remote computer. My host computer runs on Windows 10 and I have also configured the firewall to allow TCP/UDP in/out traffic through port 3838.

在 RStudio 上运行命令 options(shiny.host="0.0.0.0") 后,我让闪亮的服务器在主机 0.0.0.0 上工作,但我仍然只能看到 ui.R 控件呈现,而 server.R 没有任何内容那仍然是灰色的.

I have got shiny server working on host 0.0.0.0 after running the command options(shiny.host="0.0.0.0") on RStudio but I still only can see the ui.R controls rendered and nothing from server.R that is still grayed.

知道是什么导致了这种行为吗?

Any idea of what can be causing this behaviour?

推荐答案

为了让闪亮的服务器运行,我遵循了之前提到的 www.rstudio.com/products/shiny/download-server/中的官方安装指南.

In order to get shiny server running I have followed the official installation guide in www.rstudio.com/products/shiny/download-server/ as mentioned before.

有一些细节可以让我从远程主机(通过 Internet 连接到我的网络之外的计算机)运行它.

There are a few details that allowed me to make it run from a remote host (a computer outside my network connecting via Internet).

  1. 始终以 root 用户身份安装软件包,以便在每个用户之间共享它们,即 sudo su - \ -c "R -e \"install.packages('shiny', repos='.......(我还不能发布超过 2 个链接:(
  2. 将 Shiny 主机设置为 0.0.0.0,但在 R studio 上运行此命令:options(shiny.host="0.0.0.0")
  3. 在主机的防火墙内外打开端口 3838 TCP 和 UDP.
  4. 在我的路由器中分别打开 UDP 和 TCP 端口;不是TCP 和 UPD",而是先是 TCP,然后是 UDP.
  5. 打开 3838-3840 范围内的先前端口,而不仅仅是 3838 端口.这不是我可以解释的,因为我期望 3838 就足够了,因为 Shiny-server 在主机 0.0.0.0:3838 上运行;但就我而言,我需要这样做.
  6. 为了方便起见,我为运行闪亮服务器的计算机分配了一个固定 IP.点击此处查看网络连接图片

这是我的路由器配置的屏幕截图,以防有人发现它有用:单击此处查看路由器端口转发的闪亮图像

Here is a screenshot of my router configuration just in case someone finds it useful: Click here to see router port forwarding for shiny image

这篇关于无法远程连接到闪亮的服务器并使 R 应用程序正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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