Apache重定向到闪亮的服务器返回404

时间:2015-08-04 13:41:19

标签: apache amazon-ec2 shiny-server

我在安装了Apache 2.4的Amazon EC2(Ubuntu)实例上运行闪亮的服务器。我想创建用户身份验证,所以我设置了shiny-server来只监听localhost。 闪亮的服务器配置如下所示:

# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;

# Define a server that listens on port 3838
server {
  listen 3838 localhost;

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

我在/etc/apache2/apache2.conf文件

的末尾添加了以下行
<VirtualHost *:80>

   Redirect /TestEC2 /TestEC2/
   ProxyPass /TestEC2/ http://localhost:3838/TestEC2/
   ProxyPassReverse /TestEC2/ http://localhost:3838/TestEC2/
   RedirectMatch permanent ^/TestEC2$ /TestEC2/

   <Location /TestEC2>
       AuthType Basic
       AuthName "Enter your login name and password"
       AuthUserFile /home/ubuntu/users
       Require valid-user
   </Location>

</VirtualHost>

在发光服务器配置中添加localhost之前,通过端口3838直接评估应用程序工作正常。同时重新启动Apache和Shiny Server也没有错误/警告。在评估80号港口时,我也可以看到我的默认起始页面。我在这里做错了什么?

1 个答案:

答案 0 :(得分:1)

环顾四周后,我找到了解决方案。我在apache2.conf中提供的信息需要进入sites-enables/000-default.conf。然后重启apache2。还要确保加载了模块proxyproxy_httpproxy_connect(例如a2enmod proxy