我在安装了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号港口时,我也可以看到我的默认起始页面。我在这里做错了什么?
答案 0 :(得分:1)
环顾四周后,我找到了解决方案。我在apache2.conf
中提供的信息需要进入sites-enables/000-default.conf
。然后重启apache2。还要确保加载了模块proxy
,proxy_http
和proxy_connect
(例如a2enmod proxy
)