您好亲爱的stackoverflow!
我在设置闪亮的服务器和apache2路由时遇到问题。大致遵循本指南https://support.rstudio.com/hc/en-us/articles/213733868-Running-Shiny-Server-with-a-Proxy(但使用apache2)
我设置了闪亮的运行在我的127.0.0.1:2224端口。当我打开隧道并向前移动端口时,一切正常,我在localhost上看到了我的应用程序。
我在apache中设置了pwd和重定向:
<VirtualHost *:80>
ServerAdmin karin@localhost
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPass "/myapp" "http://localhost:2224"
ProxyPassReverse "/myapp" "http://localhost:2224"
<Location /myapp>
AuthType Basic
AuthName "Enter your login name and password"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Location>
当我打开公共my.ip / myapp时,我被提示登录,在这样做后,我被重定向到本地端口2224,是的!
〜然而,应用程序似乎被打破了。我看不到任何资源,图像,css - 只是在app ui.R中编码的普通界面
我在日志中看到了大量的404,闪亮的服务器正在网上寻找所有这些资源,地址为my.ip / shared / whatever - 但资源只能通过localhost访问:2224 / shared / whatever
...
我知道哪里弄乱了路由?缺少什么特权,或者在没有设置ssh隧道和端口转发的情况下尝试访问我的应用程序的内容是什么?
非常感谢任何想法!
大致遵循本指南https://support.rstudio.com/hc/en-us/articles/213733868-Running-Shiny-Server-with-a-Proxy(但使用apache2)
在详细介绍该指南时,我已成功使用apache2作为闪亮服务器的反向代理,特别是最后一个示例。在你的情况下,你应该更换
ProxyPass "/myapp" "http://localhost:2224"
ProxyPassReverse "/myapp" "http://localhost:2224"
同
RedirectMatch permanent ^/myapp$ /myapp/
RewriteEngine on
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /myapp/(.*) ws://localhost:2224/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /myapp/(.*) http://localhost:2224/$1 [P,L]
ProxyPass /myapp/ http://localhost:2224/
ProxyPassReverse /myapp/ http://localhost:2224/
Header edit Location ^/ /myapp/
ProxyRequests Off