Install RStudio on Apache2
2013-04-09 16:16 robturtle 阅读(371) 评论(0) 编辑 收藏 举报Apache Configuration
To enable an instance of Apache running on the same server to act as a front-end proxy to RStudio you need to use the mod_proxy
. The steps for enabling this module vary across operating systems so you should consult your distribution's Apache documentation for details.
On Debian and Ubuntu systems Apache can be installed with mod_proxy
using the following commands:
sudo apt-get install apache2
sudo apt-get install libapache2-mod-proxy-html
sudo apt-get install libxml2-dev
Then, to update the Apache configuration files to activate mod_proxy
you execute the following commands:
sudo a2enmod proxy
sudo a2enmod proxy_http
Once you have enabled mod_proxy
in your Apache installation you need to add the required proxy commands to your VirtualHost
definition. For example:
<VirtualHost *:80>
<Proxy *>
Allow from localhost
</Proxy>
ProxyPass / http://localhost:8787/
ProxyPassReverse / http://localhost:8787/
</VirtualHost>
Note that if you want to serve RStudio from a custom path (e.g. /rstudio) you would replace the ProxyPass directives described above to:
ProxyPass /rstudio/ http://localhost:8787/
ProxyPassReverse /rstudio/ http://localhost:8787/
RedirectMatch permanent ^/rstudio$ /rstudio/
Finally, after you've completed all of the above steps you'll then need to restart Apache so that the proxy settings take effect:
sudo /etc/init.d/apache2 restart
注意:rstudio-server 从系统 passwd 数据库提取用户信息。要想成功登录,该用户必须要有家目录。否则会报connection failed