问题描述
jupyer lab界面保存文件时提示Jupyter Lab throwing 413: Request Entity Too Large
解决方法
- 修改nginx配置,在配置中增加/修改
client_max_body_size
:
完整配置文件为
upstream my-notebook-workhorse {
server 127.0.0.1:8888 fail_timeout=0;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# let my-notebook deal with the redirection
server {
listen 80;
server_name my-notebook.wh;
server_tokens off;
root /dev/null;
# Increase this if you want to upload larger attachments
client_max_body_size 64m;
# individual nginx logs for this vhost
access_log /var/log/nginx/my-notebook_access.log;
error_log /var/log/nginx/my-notebook_error.log;
location / {
proxy_pass http://my-notebook-workhorse;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
auth_basic "Restricted Content";
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Origin "";
proxy_read_timeout 86400;
}
}
- 重新启动nginx后保存正常
docker-compose restart nginx
或重新加载nginx配置文件
docker exec <dockername> nginx -s reload