[关闭]
@TedZhou 2024-06-14T11:57:50.000000Z 字数 1206 阅读 173

nginx代理uwsgi添加url前缀的正确方法

nginx uwsgi SCRIPT_NAME fixpathinfo


  1. # nginx 配置
  2. location ~ ^/prefix/ {
  3. include uwsgi_params;
  4. uwsgi_param SCRIPT_NAME /prefix;#Pass the URL prefix to uWSGI so the "fixpathinfo:" route-rule can strip it out
  5. uwsgi_pass 127.0.0.1:6666;
  6. }
  1. # uwsgi 配置
  2. [uwsgi]
  3. socket = 127.0.0.1:6666
  4. route-run = fixpathinfo:
  5. wsgi = sample:app
  6. ...
  7. # 不依赖配置的等价命令行
  8. uwsgi --socket 127.0.0.1:6666 --route-run fixpathinfo: --master -p 4 -w sample:app --pidfile sample.pid --daemonize2 ./sample.log

nginx代理 jupyter notebook 的配置

  1. #生成配置文件,打开编辑之
  2. jupyter notebook --generate-config
  3. vim ~/.jupyter/jupyter_notebook_config.py
  1. # Configuration file for notebook.
  2. c = get_config() #noqa
  3. c.ServerApp.ip = '127.0.0.1'
  4. c.ServerApp.port = 5000
  5. c.ServerApp.root_dir = '/pathto.ipynb'
  6. #c.NotebookApp.notebook_dir = '/pathto.ipynb'
  7. c.NotebookApp.base_url = '/notebook'
  8. c.NotebookApp.open_browser = False
  9. #c.NotebookApp.allow_root = True
  1. # nginx 配置
  2. location ~ /notebook/ {
  3. proxy_redirect off;
  4. proxy_buffering off;
  5. proxy_set_header Host $host;
  6. proxy_set_header X-Real-IP $remote_addr;
  7. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  8. proxy_pass http://127.0.0.1:5000;
  9. proxy_http_version 1.1;
  10. #websocket
  11. proxy_set_header Upgrade $http_upgrade;
  12. proxy_set_header Connection "upgrade";
  13. proxy_connect_timeout 30s;
  14. proxy_read_timeout 3600s;
  15. proxy_send_timeout 90s;
  16. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注