2017-02-18 149 views
1

我正在尝试配置NGINX服务器,以便可以通过NGINX运行闪亮的服务器和闪亮的应用程序,并提供适当的密码保护。我NGINX默认文件在下面的示例所示:如何配置shiny-server在Ubuntu上通过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; 
    } 
} 

当我去到本地主机:80显示闪亮的欢迎页面,但两个应用程序“你好”和“RMD”不运行(参见下图) 。 enter image description here

没有人有任何线索我在做什么错在这里?

帮助将不胜感激。

卡斯帕

回答

0

这里是nginx的默认文件“的网站,可参考”如何应该是什么样子。请记住还要配置R闪亮的服务器文件。

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; 
    } 
} 
0

您需要添加位置的nginx的cofiguration文件您的应用程序也是如此,如:

location /hello { 
    proxy_bind 127.0.0.1; 
    proxy_pass http://localhost:8080/hello; 
} 
相关问题