我无法帮助Jupyter和Spark,但希望这个答案对你有帮助。
如果您计划在反向代理之后放置一些内容,则应该验证它是否可以在反向代理之后工作,如您所述。
127.0.0.1/jupyter/tree,它将我重定向到127.0.0.1/tree
因为对于Jupyter root来说
/
不是
/jupyter
,所以你需要在配置中找到如何更改它,作为Grafana的一个例子。
# The full public facing url you use in browser, used for redirects and emails
If you use reverse proxy and sub path specify full url (with sub path)
root_url = https://example.com/grafana
</code>
NGINX配置可以简化,请看这个例子:
的
nginx配置
</强>
# /etc/nginx/conf.d/default.conf
server {
listen 80 default_server;
location = /echo1 {
rewrite ^ /echo1/ permanent;
}
location = /echo2 {
rewrite ^ /echo2/ permanent;
}
location /echo1/ {
proxy_pass http://echo1:8000/;
}
location /echo2/ {
proxy_pass http://echo2:8000/;
}
location / {
return 404;
}
}
</code>
的
泊坞窗,撰写
</强>
version: “3.2”
services:
nginx:
image: ddmitrii/nginx-sample:echo2
ports:
- '80:80'
echo1:
image: ddmitrii/echo
command: --url --id echo1
echo2:
image: ddmitrii/echo
command: --url --id echo2
</code>
的
测试
</强>
$ curl -L localhost/echo1/
echo1 GET /
$ curl -L localhost/echo2
echo2 GET /
</code>
的
备注
</强>
变量
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
</code>
只有在需要软件时才应该放置到位,这些名称就像
X-Real-IP
可以是不同的,您需要用软性要求进行验证。
你不需要
重写^ / rstudio(/.*)$ 1休息;
因为nginx会自动遵循正确的规则,所以你需要为路径重写规则
/path
,切断
path
,所以它会
/
(或者是其他东西)
旋转变压器127.0.0.11有效= 5s;
因为你使用localhost
设置$ upstream_endpoint jupyter:8888;
因为proxy_pass。
proxy_redirect $ scheme:// $ upstream_endpoint / $ scheme:// $ host / jupyter /;
因为proxy_pass。
其他一切看起来都不错