r 闪亮的服务器是 运行,但该应用程序无法运行

r shiny server is running, but the app is not working

我们在 linux ubuntu 上构建了 shiny-server,我检查了状态和 shiny-server.conf,两者似乎都可以,但无法 运行 app,请看下图: 1.闪亮服务器状态:

  root@ubuntu:~# sudo status shiny-server
  shiny-server start/running, process 43150
  1. server.conf

    # Instruct Shiny Server to run applications as the user "shiny"
    run_as shiny;
    
    # Define a server that listens on port 3838
    server {
      listen 3838;
    
      # Define a location at the base URL
      location / {
    
        # Host the directory of Shiny Apps stored in this directory
        site_dir /srv/shiny-server;
    
        # Log all Shiny output to files in this directory
        log_dir /var/log/shiny-server;
    
        # When a user visits the base URL rather than a particular application,
        # an index of the applications available in this directory will be shown.
        directory_index on;
      }
    }
    

但是,当我将 server.RUI.R 文件放在 srv/shiny-server 下,然后将 运行 放在 URL 下时,它是徒劳的,并显示 "Not found"。

 http://<my_server>:3838/<app_name>

下面的代码显示了创建的所有应用程序文件夹,您可以在其下创建各种应用程序,如 app1、app2..等

下方将显示

下的所有应用
http://<my_server>:3838/allappfolders

下面的 app1 将加载 ui.R 和 server.R

http://<my_server>:3838/allappfolders/app1

完全确认。代码如下:

# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;

# Define a server that listens on port 3838
server {
  listen 3838;

    location /users {
      run_as :HOME_USER:;
      user_dirs;
    }

    # Define a location at the base URL
    location /allappfolders {
        run_as shiny;

        # Host the directory of Shiny Apps stored in this directory
        site_dir /opt/shiny-server/allappfolders;

        # Log all Shiny output to files in this directory
        log_dir /var/log/shiny-server/allappfolders;

        # When a user visits the base URL rather than a particular application,
        # an index of the applications available in this directory will be shown.
        directory_index on;
    };

    # Define a location at the base URL
    location /app1 {

        # Host the directory of Shiny Apps stored in this directory
        app_dir /opt/shiny-server/allappfolders/app1;

        # Log all Shiny output to files in this directory
        log_dir /var/log/shiny-server/app1;

        # When a user visits the base URL rather than a particular application,
        # an index of the applications available in this directory will be shown.
        directory_index off;
    };

    # Define a location at the base URL
    location /app2 {

        # Host the directory of Shiny Apps stored in this directory
        app_dir /opt/shiny-server/allappfolders/app2;

        # Log all Shiny output to files in this directory
        log_dir /var/log/shiny-server/app2;

        # When a user visits the base URL rather than a particular application,
        # an index of the applications available in this directory will be shown.
        directory_index off;
    };

}

3838 端口 IPTABLES 问题:我在新的 LINUX CENTOS 系统上安装了 SShiny Server。 一切都很好,但示例应用程序未加载。 幸运的是,我的同事是一个 LINUX NERD,并迅速检查了端口 IPTABLE 条目。 他将其设置为 OFF 和 EUREKA!我的示例应用已经启动 运行。 当系统连接到互联网时,只需安装 rmarkdown 包。