【发布时间】:2019-04-08 14:12:33
【问题描述】:
我目前有一个实时网站,目前通过闪亮的服务器托管一个应用程序。我一直在尝试弄清楚如何托管一个额外的应用程序作为域的扩展。如果我的网站是托管主应用程序的“www.mywebsite.com”,我想在“www.mywebsite.com/SecondApp”托管另一个应用程序。我已经阅读了我找到的所有文档,看来这应该可以通过更改 /etc/shiny-server 目录中的 shiny-server.conf 文件来实现。根据Shiny Server Admin Guide 中的第 2.2.2 节位置,似乎更新配置文件应该实现这一点:
server {
...
location /SecondApp {
app_dir /srv/shiny-server/SecondApp
}
...
}
我已将相应的 ui.R 和 server.R 脚本添加到 /srv/shiny-server/SecondApp 目录,我可以在浏览器浏览器中本地运行它
MYIP:3838/SecondApp/
但是当我更新shiny-server.conf 脚本并重新启动闪亮服务器时,“www.mywebsite.com/SecondApp”会返回一个显示“未找到”的空白屏幕。我还没有尝试为这个应用程序设置一个新端口,但是从我在文档和各种 github 脚本中看到的所有内容来看,这个配置似乎应该可以工作。我错过了什么?我的完整配置文件如下所示:
# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;
# Define a server that listens on port 3838
server {
listen 3838;
log_dir /var/log/shiny-server;
# Add extension
location /SecondApp {
app_dir /srv/shiny-server/SecondApp;
}
# 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;
}
}
这里的问题是端口吗?看起来 3838 是默认的闪亮服务器端口,据我所见,其他人有时会更新它以通过自己的端口运行。但正如我所提到的,我运行的当前站点运行良好。我还尝试通过添加一个额外的位置来更新 /etc/nginx/sites-enabled 目录中的 nginx 配置文件,但这没有帮助:
server {
...
location /SecondApp {
proxy_pass http://MYIP:3838/SecondApp/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
...
}
除非这与我的实际域有关,否则我很茫然。有任何想法吗?谢谢!
【问题讨论】:
-
AFAIK 不可能在
/和/secondApp拥有应用程序,因为这些位置是嵌套的。请改用/firstApp和/secondApp。如果你真的需要一个嵌套结构,你可以让它与符号链接一起使用
标签: r nginx shiny shiny-server