R- Shiny webserver on a local server

Mark picture Mark · Sep 16, 2014 · Viewed 27.1k times · Source

I have a windows machine with IIS and I can see the IIS welcome page on http://myname/. I have recently started using Shiny through its own server and I can see shiny apps on http://127.0.0.1:port

Now my question is how can I allow others to see my shiny apps on http://myname:port ? (since 127.0.0.1 is not accessible from other computers). Is this possible with the free version of shiny?

Answer

Andrey Wal picture Andrey Wal · Feb 29, 2016

You should make following:

  1. Find your IP ("ipconfig" from cmd prompt in Windows)
  2. Set Shiny to start from port "XXXX" and your IP (instead of 127.0.0.1)

    For example:

    options(shiny.port = 7775)

    options(shiny.host = "192.0.0.45")

  3. Run your App

    runApp(app)

Make sure the port is opened in your firewall.

To be a bit more precise, this is how your file startApp.R might look like:

library(shiny)
options(shiny.host = '0.0.0.0')
options(shiny.port = 8888)
runApp('shinyapp')

This is an example of how you would set the options if Shiny was running behind nginx with tcp.