OncoHarmony-Network / OncoHarmony-Network.github.io

https://oncoharmony-network.github.io/
0 stars 0 forks source link

shiny-server安装和配置 #10

Open ShixiangWang opened 9 months ago

ShixiangWang commented 9 months ago

参考博文在Ubuntu服务器上配置Shiny应用进行基本的安装和配置。注意 zhoulab 服务器没有将 shiny 加入 sudo 用户,而是直接使用 root 进行相关的 sudo 操作。

shiny server 配置文件内容:

# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;
preserve_logs true;
app_idle_timeout 0;
# 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;
  }
}

主要是增加了第3行和第4行,其他的没动过。

nginx 的配置参考文章shiny应用的nginx配置

ShixiangWang commented 6 months ago

app_idle_timeout 0; 可能不太合适。之前是想避免 app 经常断线,现在fusion的app测试发现会导致session一直在工作,可能会影响代码更新和自动加载新的网页(待测试),所以改成 3600 s。

app_idle_timeout -- Defines the amount of time (in seconds) an R process with no active connections should remain open. After the last connection disconnects from an R process, this timer will start and, after the specified number of seconds, if no new connections have been created, the R process will be killed. The default value for app_idle_timeout is 5 seconds.