如何从nginx反向代理使用jupter服务器
我需要管理几个jupyter笔记本服务器,因此我希望通过nginx反向代理使用它们 docker-compose.yaml如何从nginx反向代理使用jupter服务器,nginx,jupyter-notebook,reverse-proxy,Nginx,Jupyter Notebook,Reverse Proxy,我需要管理几个jupyter笔记本服务器,因此我希望通过nginx反向代理使用它们 docker-compose.yaml version: '3' services: jupyter: image: jupyter/datascience-notebook container_name: 'jupyter-rp' ports: - 8888:8888 reverse-proxy: image: nginx volumes:
version: '3'
services:
jupyter:
image: jupyter/datascience-notebook
container_name: 'jupyter-rp'
ports:
- 8888:8888
reverse-proxy:
image: nginx
volumes:
- ./reverse-proxy/nginx.conf:/etc/nginx/nginx.conf
ports:
- 80:80
反向代理/nginx.conf
events {
worker_connections 16;
}
http {
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://[remote server's local ip address]:8888/;
}
}
}
此设置运行良好我可以通过http://[远程服务器的本地ip地址]/
然后我换通行证
location /jupyter {
proxy_pass http://[remote server's local ip address]:8888/;
}
它无法通过http://[远程服务器的本地ip地址]/jupyter/
访问日志如下所示
jupyter-rp | [I 08:26:28.918 NotebookApp] 302 GET / (172.23.0.1) 0.940000ms
reverse-proxy_1 | 10.13.170.137 - - [06/May/2021:08:26:28 +0000] "GET /jupyter HTTP/1.1" 302 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36"
reverse-proxy_1 | 10.13.170.137 - - [06/May/2021:08:26:28 +0000] "GET /tree? HTTP/1.1" 404 556 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36"
reverse-proxy_1 | 2021/05/06 08:26:28 [error] 23#23: *4 open() "/etc/nginx/html/tree" failed (2: No such file or directory), client: 10.13.170.137, server: localhost, request: "GET /tree? HTTP/1.1", host: "10.65.4.41"
此案例服务器尝试通过重定向返回/etc/nginx/html/tree
。我应该如何更改nginx.conf
这是一个类似的问题,但没有得到回答。