How to configure RStudio Server on Ubuntu to run shiny apps.

I have RStudio Server and Shiny Server installed on a ubuntu machine and I can transfer the apps I make from RStudio over to the Server with no problem, but I can not hit the run button in RStudio Server to run the apps in RStudio before moving them over to the server.

Whenever I do it just deploys the app and immediately grey it out.

Here is what I get when running the default shinyApp. Image and Code below.

The only similar post I found was!topic/shiny-discuss/ToUO30b6WxI

# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
# Find out more about building applications with Shiny here:


# Define UI for application that draws a histogram
ui <- fluidPage(

    # Application title
    titlePanel("Old Faithful Geyser Data"),

    # Sidebar with a slider input for number of bins 
                        "Number of bins:",
                        min = 1,
                        max = 50,
                        value = 30)

        # Show a plot of the generated distribution

# Define server logic required to draw a histogram
server <- function(input, output) {

    output$distPlot <- renderPlot({
        # generate bins based on input$bins from ui.R
        x    <- faithful[, 2]
        bins <- seq(min(x), max(x), length.out = input$bins + 1)

        # draw the histogram with the specified number of bins
        hist(x, breaks = bins, col = 'darkgray', border = 'white')

# Run the application 
shinyApp(ui = ui, server = server)

One typical source for this error is a blocked websocket connection. You can open the Shiny app in a browser, open the "Network" tab in the "Developer Tools" and reload the app. Typically this will show some blocked requests. If so, which requests get blocked?

One typical source of blocked websocket connections is using a reverse proxy. Are you using one? How did you configure the proxy?

It's not highlighting any of the network objects in red which is usually how I find errors. I assume it is in either the "websockets/" or the "f408ebb1/" "http://'dummyhost'/rstudio/p/f408ebb1/" in the websockets part I am seeing "Error during WebSocket handshake: Unexpected response code: 404" so I think it's that one creating the error.

I actually didn't set up the RStudio Server so I don't know if and how the proxy is configured.
I am fairly sure that they just installed RStudio behind the apache proxy since going to the root page is the "Apache2 Ubuntu Default Page"

Would this be the correct resource to find out more?

From reading that it seems like just installing RStudio Server will not allow one to run shiny applications without first creating a proxy and setting up a proxy first.

It seems like the next steps I have to do are

  1. Verify RStudio Server is behind the Apache proxy.
  2. Follow the guide to set it up correctly.

I might be good from here. Thanks for the help .

You did verify it is running behind a proxy by going to the root page and seeing the "Apache2 Ubuntu Default Page"! The guide you linked is for an older version, unless you are using version 1.1.322, in which case you should consider upgrading. The recommended guide for an up-to-date system would be Redirect.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.