问题
I HAVE FIXED THIS ISSUE. Please read answer below
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.
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.
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.
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?
回答1:
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.
There are a few details that allowed me to make it run from a remote host (a computer outside my network connecting via Internet).
- Installing packages always as root user so that they are shared among every user, ie, sudo su - \ -c "R -e \"install.packages('shiny', repos='....... (I cannot post more than 2 links yet :(
- Setting Shiny host to 0.0.0.0, but running on R studio this command: options(shiny.host="0.0.0.0")
- Opening ports 3838 TCP and UDP, both in and out on my host's firewall.
- Opening separately UDP and TCP ports in my router; not "TCP and UPD" but first TCP and then UDP.
- Opening the previous ports by the range 3838-3840, not just the 3838 one. This is not something I can give an explanation about since I was expecting that 3838 would be sufficient because shiny-server is running on host 0.0.0.0:3838; but in my case I needed to do it.
- In order to make it easier, I assigned a fixed IP to the computer running shiny server. click here to see network connection image
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
来源:https://stackoverflow.com/questions/36568434/cannot-connect-remotely-to-shiny-server-and-get-r-app-working-properly