Why I can't access remote Jupyter Notebook server?
I have started a Jupyter Notebook server on my centos6.5 server.And jupyter is running like
[I 17:40:59.649 NotebookApp] Serving notebooks from local directory: /root
[I 17:40:59.649 NotebookApp] 0 active kernels
[I 17:40:59.649 NotebookApp] The Jupyter Notebook is running at:https://[all ip addresses on your system]:8045/
[I 17:40:59.649 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
When I want to access Jupyter remotely in the same local area network, say open http://192.168.1.111:8045/
, I can't open a Jupyter page at all. By the way, I can access remote centos server successfully.
What's the possible reason?
Solution 1:
Have you configured the jupyter_notebook_config.py file to allow external connections?
By default, Jupyter Notebook only accepts connections from localhost (eg, from the same computer that its running on). By modifying the NotebookApp.allow_origin option from the default ' ' to '*', you allow Jupyter to be accessed externally.
c.NotebookApp.allow_origin = '*' #allow all origins
You'll also need to change the IPs that the notebook will listen on:
c.NotebookApp.ip = '0.0.0.0' # listen on all IPs
Also see the details in a subsequent answer in this thread.
Documentation on the Jupyter Notebook config file.
Solution 2:
I managed to get the access my local server by ip using the command shown below:
jupyter notebook --ip xx.xx.xx.xx --port 8888
replace the xx.xx.xx.xx
by your local ip of the jupyter server.
Solution 3:
James023 already stated the correct answer. Just formatting it
if you have not configured jupyter_notebook_config.py file already
Step1: generate the file by typing this line in console
jupyter notebook --generate-config
Step2: edit the values
gedit /home/koushik/.jupyter/jupyter_notebook_config.py
( add the following two line anywhere because the default values are commented anyway)
c.NotebookApp.allow_origin = '*'
#allow all origins
c.NotebookApp.ip = '0.0.0.0'
# listen on all IPs
Step3: once you closed the gedit, in case your port is blocked
sudo ufw allow 8888
# enable your tcp:8888 port, which is ur default jupyter port
Step4: set a password
jupyter notebook password
# it will prompt for password
Step5: start jupyter
jupyter notebook
and connect like http://xxx.xxx.xxx.xxx:8888/login?