Rstudio Server使用Nginx反向代理二级目录 隐藏端口及路径

文章目录[隐藏]

前言

Rstudio的登录页我们一直想要做在同一个域名下,但是每次设置二级目录反代都会失败,例如:
我们设置http://www.a.com/rstudio/反代http://1.1.1.1:8787,那么登录页面访问是正常的,但是登录后rstudio会自动跳转到http://www.a.com:8787/
于是发现除了反代外,还需要写一个rewrite规则。

反代规则案例



#PROXY-START/stu-basic-2/

location /rstudio/ { rewrite ^/rstudio/(.*)$ /$1 break; proxy_pass http://1.1.1.1:8787/; proxy_redirect http://1.1.1.1:8787/ $scheme://$http_host/rstudio/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection upgrade; proxy_read_timeout 20d;

#Set Nginx Cache  

	add_header Cache-Control no-cache;

expires 12h;

}

#PROXY-END/rstudio/


This article is under CC BY-NC-SA 4.0 license.
Please quote the original link:https://www.liujason.com/article/1023.html
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy