nginx - 如何配置 Shiny 服务器在 Ubuntu 上通过 NGINX 运行?

标签 nginx shiny shiny-server nginx-location

我正在尝试配置 NGINX 服务器,以便 Shiny 的服务器和 Shiny 的应用程序可以通过 NGINX 运行,并具有适当的密码保护。我的 NGINX 默认文件如下例所示:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /srv/shiny-server/;
    #index index.html;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
        proxy_bind 127.0.0.1;
        proxy_pass http://localhost:8080/;
        proxy_redirect http://localhost:8080/ $scheme://$host/;
        auth_basic "Username and Password are required"; 
        auth_basic_user_file /etc/nginx/.htpasswd;

        try_files $uri $uri/ =404;
    }
}

当我转到 localhost:80 时,会显示 Shiny 的欢迎页面,但两个应用程序“hello”和“rmd”不会运行(请参见下面的屏幕截图)。 enter image description here

有人知道我在这里做错了什么吗?

我们将非常感谢您的帮助。

卡斯帕

最佳答案

您还需要在nginx的配置文件中添加您的应用程序的位置,例如:

location /hello {
    proxy_bind 127.0.0.1;
    proxy_pass http://localhost:8080/hello;
}

关于nginx - 如何配置 Shiny 服务器在 Ubuntu 上通过 NGINX 运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42316113/

相关文章:

ruby-on-rails - 生产环境 Nginx 中的 Rails 5 ActionController::InvalidAuthenticityToken

node.js - 403禁止+ Nginx +虚拟主机配置+ NodeJS

ssl - HTTPS 重定向不适用于 nginx-ingress-controller 的默认后端

r - 如何在 Shiny 的应用程序中为循环内的多图生成输出?

R和 Shiny : Using output of a reactive function

php - str_replace() 在 aws 服务器中不工作,返回空字符串,但在 cpanel 和本地工作

html - R Shiny withProgress Indicator Within Fluid Container

r - 如何使用 R Shiny 中的选择控件获取选项组?

ubuntu - VPS 与 Ubuntu 20.04 : Cannot connect to Github

R: Git + Shiny 服务器自动化部署