@TedZhou
2024-06-14T11:57:50.000000Z
字数 1206
阅读 160
nginx
uwsgi
SCRIPT_NAME
fixpathinfo
# nginx 配置
location ~ ^/prefix/ {
include uwsgi_params;
uwsgi_param SCRIPT_NAME /prefix;#Pass the URL prefix to uWSGI so the "fixpathinfo:" route-rule can strip it out
uwsgi_pass 127.0.0.1:6666;
}
# uwsgi 配置
[uwsgi]
socket = 127.0.0.1:6666
route-run = fixpathinfo:
wsgi = sample:app
...
# 不依赖配置的等价命令行
uwsgi --socket 127.0.0.1:6666 --route-run fixpathinfo: --master -p 4 -w sample:app --pidfile sample.pid --daemonize2 ./sample.log
#生成配置文件,打开编辑之
jupyter notebook --generate-config
vim ~/.jupyter/jupyter_notebook_config.py
# Configuration file for notebook.
c = get_config() #noqa
c.ServerApp.ip = '127.0.0.1'
c.ServerApp.port = 5000
c.ServerApp.root_dir = '/pathto.ipynb'
#c.NotebookApp.notebook_dir = '/pathto.ipynb'
c.NotebookApp.base_url = '/notebook'
c.NotebookApp.open_browser = False
#c.NotebookApp.allow_root = True
# nginx 配置
location ~ /notebook/ {
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:5000;
proxy_http_version 1.1;
#websocket
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_connect_timeout 30s;
proxy_read_timeout 3600s;
proxy_send_timeout 90s;
}