更改RStudio_AMI上的文档根目录
它位于amazon服务器上,因此我查看了以下帖子: 及 或一般而言: 到目前为止,提供的信息确实帮助了我。 我能在etc/apache2文件夹中找到的唯一文件如下: 编辑:配置文件的内容是: “别名/javascript/usr/share/javascript/ 选项如下符号链接多视图 " 两个月前我在他的网站上问过他,但没有得到答案 我的问题:如何更改RStudio AMI服务器上的文档根目录,以便将RStudio登录页的目录从根目录更改为-say-domain.com/login,并在根目录(domain.com)上有一个登录页+其他文件夹 谢谢你的帮助 编辑: 在Frédéric Henri的回答和编辑之后: 这是我的rstudio.conf文件的内容更改RStudio_AMI上的文档根目录,r,ubuntu,amazon-ec2,rstudio,amazon-ami,R,Ubuntu,Amazon Ec2,Rstudio,Amazon Ami,它位于amazon服务器上,因此我查看了以下帖子: 及 或一般而言: 到目前为止,提供的信息确实帮助了我。 我能在etc/apache2文件夹中找到的唯一文件如下: 编辑:配置文件的内容是: “别名/javascript/usr/share/javascript/ 选项如下符号链接多视图 " 两个月前我在他的网站上问过他,但没有得到答案 我的问题:如何更改RStudio AMI服务器上的文档根目录,以便将RStudio登录页的目录从根目录更改为-say-domain.com/login,并在
location / {
proxy_pass http://localhost:8787;
proxy_redirect http://localhost:8787/ $scheme://$host/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 20d;
access_log /var/log/nginx/rstudio-access.log;
error_log /var/log/nginx/rstudio-error.log;
}
假设index.html文件位于/home/idx/index.html目录中,那么如何更改该文件。
以下内容对我不起作用:
proxy_pass http://localhost/home/idx;
proxy_redirect http://localhost/home/idx/ $scheme://$host/;
或:
我将在何处配置以将我的rstudio登录重定向到。
谢谢大家! 如果您使用的是apache2/httpd web服务器,那么您是对的,并且看到了正确的位置;但在RStudio AMI的情况下,它使用的所有配置都存储在
/etc/nginx
您可以查看如何使用conf文件
在当前配置中,它主要定义在3个位置:
http://
/etc/nginx/RStudioAMI/rstudio.conf
它处理所有请求并转发到运行rstudio的地方
http:///julia
/etc/nginx/RStudioAMI/julia.conf
它处理所有请求并转发到julia正在运行的地方
http:///shiny
/etc/nginx/RStudioAMI/shinny.conf
它处理所有请求并转发到shinny运行的地方
例如,您可以将主位置(即指向特定文件夹的/
)更改为处理http:///rstudio
编辑
我将在何处配置以将我的rstudio登录重定向到
如果您想从http:///rtudio
(例如)您需要在`/etc/nginx/RStudioAMI/rstudio.conf中进行更改``
location /rstudio/ {
proxy_pass http://localhost:8787/;
proxy_redirect http://localhost:8787/ $scheme://$host/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 20d;
access_log /var/log/nginx/rstudio-access.log;
error_log /var/log/nginx/rstudio-error.log;
}
如果要指向主http:///index.html
指向/home/idx/index.html
您需要在/etc/nginx/sites enabled/RStudioAMI.conf
中进行更改,并定义一个指向根元素的主位置
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80 default_server;
index index.html;
location = / {
root /var/www/html;
}
include /etc/nginx/RStudioAMI/*.conf;
}
注意:无论何时更改nginx conf文件,都需要重新启动nginx。
使用:
/etc/init.d/nginx restart
可以发布列出的conf文件的内容吗?谢谢您的评论。我在帖子中做了一个编辑。嗨,非常感谢你的回答,它已经很有帮助了,但我还没完成。你能再看一眼吗?Sry,我花了一段时间。我试着自己尽我所能去弄清楚。上述解决方案对我来说还不起作用,但我发现了几天前发表的另一篇文章:,这篇文章也指向了这个方向。你能再看一眼吗?
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80 default_server;
index index.html;
location = / {
root /var/www/html;
}
include /etc/nginx/RStudioAMI/*.conf;
}