【问题标题】:Run shinyapp in https mode在 https 模式下运行 shinyapp
【发布时间】:2020-08-20 09:39:51
【问题描述】:

我想使用命令 shiny::runApp() 部署我的应用程序。我的问题是是否可以使用 https 而不是 http 来执行此操作(我无法安装闪亮的服务器)。

现在我以这种模式运行:shiny::runApp("app.R", port=3090, host="myipaddress")。我有一个指向 IP 地址的域,如果我在浏览器中写入:http://mydomain:3090 可以正常工作。

我的问题是我找不到从http://mydomain:3090 切换到https://mydomain:3090 的任何模式。

感谢任何帮助

【问题讨论】:

  • 这不是nginx或者haproxy的问题吗?我的意思是,您可以让反向代理处理 ssl 证书,然后重定向到您闪亮的应用程序。基本上 user->nginx-shiny app... 用户和 nginx 之间的连接是通过 https,而 nginx 和应用程序之间的连接是通过 http(或 TCP)。
  • 感谢@SergioRomero。是否可以使用 Apache 而不是 Nginx 执行您的建议?
  • 我认为您可以使用任何您想要的反向代理,只要它可以将流量从端口 80 重定向到 443 并处理 ssl 证书。

标签: r shiny


【解决方案1】:

根据 Sergio Romero 的建议,我在 Apache 的 443 端口上使用了反向代理并处理了 ssl 证书。 我跟着 this guide 在 Apache 上设置虚拟主机的配置

<VirtualHost *:443>
  ServerName mydomainname

  <Proxy *>
    Allow from mydomainname
  </Proxy>

  RewriteEngine on
  RewriteCond %{HTTP:Upgrade} =websocket
  RewriteRule /(.*) ws://mydomainname:myport/$1 [P,L]
  RewriteCond %{HTTP:Upgrade} !=websocket
  RewriteRule /(.*) http://mydomainname:myport/$1 [P,L]

  ProxyPass / http://mydomainname:myport/
  ProxyPassReverse / http://mydomainname:myport/
  ProxyRequests Off

  ## SSL directives
  SSLEngine on
  SSLCertificateFile      "path_to_cert.pem"
  SSLCertificateKeyFile   "path_to_privkey.pem"
  SSLCertificateChainFile "path_to_fullchain.pem"
</VirtualHost>

【讨论】:

    猜你喜欢
    • 2019-05-19
    • 2015-12-05
    • 1970-01-01
    • 2018-02-06
    • 2023-04-03
    • 1970-01-01
    • 2021-10-30
    • 2018-02-02
    • 1970-01-01
    相关资源
    最近更新 更多