首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >nginx后面的jupyter笔记本无法保存

nginx后面的jupyter笔记本无法保存
EN

Stack Overflow用户
提问于 2017-01-12 18:33:00
回答 1查看 826关注 0票数 1

我有一台运行jupyter notebook的机器,具有以下设置:

代码语言:javascript
复制
c.NotebookApp.password = u'sha1:'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 9999
c.NotebookApp.base_url = '/notebook/'
c.NotebookApp.allow_origin = '*'
c.NotebookApp.trust_xheaders = True

设置如下的nginx配置文件:

代码语言:javascript
复制
server {
listen   80;


server_name example.domain.com;

return 301 https://$server_name$request_uri;
}

server {
    listen              443 default_server ssl;
    server_name         example.domain.com;
    keepalive_timeout   70;

    ssl_certificate     chained.crt;
    ssl_certificate_key .key;
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;

    location / {
        proxy_pass http://localhost:8081;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }


    location /notebook {
        proxy_pass http://localhost:9999/notebook;
        proxy_set_header X-Real_IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-NginX-Proxy true;
        proxy_ssl_session_reuse off;
        proxy_set_header Host $http_host;

        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";   
    }    

    location /notebook/nbextensions {

        proxy_pass http://localhost:9999/notebook/nbextensions/;

        proxy_set_header X-Real_IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-NginX-Proxy true;
        proxy_ssl_session_reuse off;
        proxy_set_header Host $http_host;

        # to configure the kernel for python
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";    
    }
}

我的想法是,我在8081上运行了一个不同的服务,并且我希望能够访问example.domain.com/notebook上的笔记本。

在localhost:9999上直接在本地机器上使用notebook可以很好地工作。但是当我尝试从远程地址访问它时,一切都正常,除了它不能保存笔记本。

这是(经过编辑的)错误消息:

代码语言:javascript
复制
[W 11:02:37.568 NotebookApp] Unexpected error while saving file: notebook.ipynb [|
Errno 13] Permission denied: '/.ipynb_checkpoints/notebook-checkpoint.ipynb'|
[E 11:02:37.569 NotebookApp] {                                                                                                        |
      "Content-Type": "application/json",                                                                                             |
      "Connection": "upgrade",                                                                                                        |
      "Content-Length": "4600",                                                                                                       |
      "X-Real_ip": "xxx.xxx.xxx.xxx",                                                                                                 |
      "X-Xsrftoken": "2|f9bfac9e|92b9bb14e19945238a1b3445e08c86f7|1484213065",                                                        |
      "Cookie": "_xsrf=2|f9bfac9e|92b9bb14e19945238a1b3445e08c86f7|1484213065; username-example-domain-com=\"2|1:0|10:1484213084|27:us|
ername-example-domain-com|44:Mjk3MDYzYWU2M2FkNGVmNDlkZWFiMGY4NjU5NDZlOTU=|8b4ceb3a6ebd248a84beeffd867815c7269a98f2ba1a360562034ca21c95|
ae9a\"",                                                                                                                              |
      "Accept-Encoding": "gzip, deflate, br",                                                                                         |
      "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0",                                   |
      "X-Nginx-Proxy": "true",                                                                                                        |
      "Referer": "https://example.domain.com/notebook/notebooks/notebook.ipynb", |
      "Accept-Language": "en-US,en;q=0.5",                                                                                            |
      "Accept": "application/json, text/javascript, */*; q=0.01",                                                                     |
      "Host": "example.domain.com",                                                                                                   |
      "X-Forwarded-For": "157.181.241.173",                                                                                           |
      "X-Requested-With": "XMLHttpRequest"                                                                                            |
    }
[E 11:02:37.569 NotebookApp] 500 PUT /notebook/api/contents/notebook.ipynb (127.0
.0.1) 169.93ms referer=https://example.domain.com/notebook/notebooks/notebook.ipynb

如果我在本地主机上做,同样的事情也可以。我尝试了在互联网上找到的nginx conf的其他各种设置,但都找不到。我在自己的用户下运行notebook,但我的用户对所述文件夹(以及notebook,因为在localhost上运行它不会显示此问题)具有写访问权限。据我所知,nginx不应该改变正在运行的用户,它与此无关,它只是代理对jupyter笔记本服务器的调用。所以我不知道这可能是什么问题。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-03-02 04:12:29

文件夹.ipynb_checkpoints没有正确的权限,因此必须手动设置:有关详细信息,请参阅github上的问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41610855

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档