Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R- Shiny webserver on a local server

Tags:

r

shiny

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?

like image 1000
Mark Avatar asked Sep 15 '14 23:09

Mark


People also ask

Can you run Shiny app locally?

You might be eager to deploy your Shiny app to a remote server. But the simplest way to run a Shiny app is to run it locally. You only need the shiny R package installed, and you can run the app in your browser.

How do I run a Shiny app on my server?

In the File menu, under New File, select Shiny Web App…. When prompted, choose a name for your project. Select Multiple File and choose a directory to store the new app's files. To test the project locally, click Run App in the upper right corner of the text editor.

How do you host a Shiny website?

The easiest way to turn your Shiny app into a web page is to use shinyapps.io, RStudio's hosting service for Shiny apps. shinyapps.io lets you upload your app straight from your R session to a server hosted by RStudio. You have complete control over your app including server administration tools.


2 Answers

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.

like image 92
Andrey Wal Avatar answered Sep 22 '22 12:09

Andrey Wal


The comments have already said this, but in the interest of providing an answer:

You can use shiny server (free and pro) to host apps on your own server. I believe this will allow you to set it up on http://myname/, however shiny server should be running in a linux environment as listed by @pops.

https://www.rstudio.com/products/shiny/shiny-server/

Or

you can use shiny.io to host them for you, with premium versions having the ability to set your own domain

https://www.shinyapps.io/

like image 42
DaveRGP Avatar answered Sep 25 '22 12:09

DaveRGP