设定jupyter notebook可以远程访问
关于配置远程访问jupyter-notebook的问题
好久前做过的,但是忘记了,只好记录下来了。
- 生成jupyter-notebook的web访问密码
jupyter notebook password
此时,会告诉你这个密码文件保存的位置,记录那个位置,并记录下password的字符串
- 配置jupyter-notebook的配置文件
jupyter notebook --generate-config
windows的配置文件位于: C:\Users\ls3686.jupyter, 这里ls3686是我的登录账户
linux的配置文件位于: ~/.jupyter
- 修改配置文件
# 这里的字符串就是开始生成的密码
c.NotebookApp.password = ’xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
## The IP address the notebook server will listen on.
# Default: 'localhost'
c.NotebookApp.ip = '*'
## The port the notebook server will listen on (env: JUPYTER_PORT).
# Default: 8888
c.NotebookApp.port = 8888
## Allow requests where the Host header doesn't point to a local server
#
# By default, requests get a 403 forbidden response if the 'Host' header
# shows that the browser thinks it's on a non-local domain.
# Setting this option to True disables this check.
#
# This protects against 'DNS rebinding' attacks, where a remote web server
# serves you a page and then changes its DNS to send later requests to a
# local IP, bypassing same-origin checks.
#
# Local IP addresses (such as 127.0.0.1 and ::1) are allowed as local,
# along with hostnames configured in local_hostnames.
# Default: False
c.NotebookApp.allow_remote_access = True
- 启动jupyter-notebook
jupyter notebook
就需要输入设定的密码,并且可以远程访问了。