如何在 Ubuntu 上通过 NGINX 将 shiny-server 配置为 运行?

How can I configure shiny-server to run via NGINX on Ubuntu?

我正在尝试配置 NGINX 服务器,以便可以通过具有适当密码保护的 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 时,会显示闪亮的欢迎页面,但是 "hello" 和 "rmd" 这两个应用程序不会 运行(请参见下面的屏幕截图)。

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

非常感谢您的帮助。

卡斯帕

这是 nginx "sites-available" 中默认文件的样子。记得还要配置 R shiny 服务器文件。

server {
    listen 80;

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

你也需要在nginx的配置文件中添加你的app的位置,比如:

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