在裝好了環(huán)境(SnpHub搭建 | CentOS 7下配置SnpHub所需系統(tǒng)環(huán)境)、準(zhǔn)備好了數(shù)據(jù)(SnpHub搭建 | 數(shù)據(jù)預(yù)處理與樣本描述文件準(zhǔn)備)、填好配置文件(SnpHub搭建 | 手動(dòng)處理數(shù)據(jù)后的配置文件填寫)之后,就可以準(zhǔn)備將SnpHub實(shí)例上線使用了。
1. Shiny-Server的安裝
官方介紹:Open Source Shiny Server provides a platform on which you can host multiple Shiny applications on a single server, each with their own URL or port. It enables you to support non-websocket-enabled browsers like Internet Explorer 10, and is available under an AGPLv3 license.
官方安裝教程:Download Shiny Server for Red Hat/CentOS 6+
官方配置教程:Shiny Server Professional v1.5.14 Administrator's Guide
wget https://download3.rstudio.org/centos6.3/x86_64/shiny-server-1.5.14.948-x86_64.rpm
sudo yum install --nogpgcheck shiny-server-1.5.14.948-x86_64.rpm
2. Shiny-server的簡(jiǎn)單配置與SnpHub實(shí)例上線
安裝完成后,默認(rèn)配置文件路徑為/etc/shiny-server/shiny-server.conf
去掉注釋后,配置文件內(nèi)容如下:
run_as shiny;
server {
listen 3838;
location / {
site_dir /srv/shiny-server;
log_dir /var/log/shiny-server;
directory_index on;
}
}
這表示,shiny-server正在監(jiān)聽3838端口,有一個(gè)URL路徑是URL根目錄。shiny應(yīng)用放在路徑/srv/shiny-server中,應(yīng)用日志放在/var/log/shiny-server中。
當(dāng)訪問URL<ip>:3838/的時(shí)候,shiny-server會(huì)在路徑/srv/shiny-server中尋找index.html文件。
directory_index項(xiàng)表示當(dāng)未尋找到index.html文件時(shí),是否列出文件夾內(nèi)各文件(夾)。出于安全考慮,建議設(shè)為off。
如果把SnpHub實(shí)例整個(gè)文件夾命名為SnpHub-1,并放入路徑/srv/shiny-server中,則可以通過網(wǎng)址<ip>:3838/SnpHub-1訪問到。
如果瀏覽器返回?zé)o法連接服務(wù)器或類似錯(cuò)誤,請(qǐng)檢查對(duì)應(yīng)端口是否開放、Shiny-server是否運(yùn)行
3. Shiny-server配置其他應(yīng)用路徑
若只想改變應(yīng)用放置路徑或日志文件路徑,則更改site_dir或log_dir對(duì)應(yīng)的路徑即可。
若想增加應(yīng)用路徑,下述配置文件表示增加了shiny應(yīng)用目錄/user/someone/shinyApps。當(dāng)訪問<ip>:3838/App2/snphub-2時(shí),shiny-server會(huì)在/user/someone/shinyApps路徑下(而非/srv/shiny-server)尋找shiny應(yīng)用snphub-2。
run_as shiny;
server {
listen 3838;
location / {
site_dir /srv/shiny-server;
log_dir /var/log/shiny-server;
directory_index off;
}
location /App2 {
site_dir /user/someone/shinyApps;
log_dir /user/someone/shinyLogs;
directory_index off;
}
}