【问题标题】:Running shiny apps in RStudio when proxying with nginx使用 nginx 代理时在 RStudio 中运行闪亮的应用程序
【发布时间】:2014-10-29 20:06:41
【问题描述】:

我正在尝试使用通过 nginx 代理的 RStudio 服务器来开发一个闪亮的应用程序。当我使用 RStudio(而不是服务器)运行闪亮的应用程序时,一切正常。但是,当我通过代理的 RStudio 运行时,该应用程序出现在“查看器”窗格中,但该应用程序无法正常运行。我的控制台报告该应用程序正在 localhost:3691 上运行。我是否还需要代理该端口,或者运行闪亮的 websocket 系统不能通过 nginx 代理工作?

【问题讨论】:

  • 你解决过这个问题吗?

标签: r nginx shiny rstudio


【解决方案1】:

在 Rstudio 网站上有一个操作文档,详细说明了如何使用 Nginx 或 Apache 反向代理。

https://support.rstudio.com/hc/en-us/articles/200552326-Running-RStudio-Server-with-a-Proxy

它特别提到“您还需要包含代码以正确代理 websocket,以便在 RStudio Server 中正确代理 Shiny 应用程序和 R Markdown 文档。”

【讨论】:

    【解决方案2】:

    为了让 Shiny Apps 在 RStudio Server Pro 中工作,需要 NGINX 中的 websocket 支持 .另请参阅RStudio documentation article 关于此(不幸的是,它没有具体列出哪些设置与 websocket 支持相关。

    重要的一点是:

    map $http_upgrade $connection_upgrade {
     default upgrade;
     '' close;
    }
    

    在 NGINX 配置文件的顶部。

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
    

    在 RStudio Server Pro 的 location {} 块中。

    【讨论】:

      猜你喜欢
      • 2017-06-08
      • 2013-07-08
      • 1970-01-01
      • 2017-11-07
      • 2016-12-01
      • 2016-02-09
      • 1970-01-01
      • 2021-10-08
      • 2021-09-23
      相关资源
      最近更新 更多