1. create a virtual environment in python using Virtualenv
  2. intall jupyter notebook in the virtual environment
  3. Generate jupyter.config file using the below
    • $ jupyter notebook --generate-config
  4. Maintain password using :
    • $ jupyter notebook password
  5. The password generated in stored in the json file in the same folder ad jupyter.config file
  6. Create a certificate using the following code
    • $ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mykey.key -out mycert.pem
    • Note rsa 1024 will not work and will give error
  7. Link the jupyter notebook to the certificate
    • $ jupyter notebook --certfile=mycert.pem --keyfile mykey.key
  8. Set the following line of code in jupyter.config file
    • # Set options for certfile, ip, password, and toggle off browser auto-opening
    • c.NotebookApp.certfile = u’/absolute/path/to/your/certificate/mycert.pem’
    • c.NotebookApp.keyfile = u’/absolute/path/to/your/certificate/mykey.key’ # Set ip to ‘*’ to bind on all interfaces (ips) for the public server
    • c.NotebookApp.ip = ‘*’ c.NotebookApp.password = u’sha1:bcd259ccf…<your hashed password here>’
    • c.NotebookApp.open_browser = False # It is a good idea to set a known, fixed port for server access c.NotebookApp.port = 9999
  9. create new subdomain
  10. encrypt the subdomain
    • $ certbot --expand -d jupyter.YOUR-DOMAIN.com
  11. Modify virtual host to apache server

SSLProxyEngine On
SSLProxyVerify none 
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
<Location /api>
    ProxyPass http://127.0.0.1:3000/api/
    ProxyPassReverse http://127.0.0.1:3000/api/
    ProxyPass https://127.0.0.1:3000/api/
    ProxyPassReverse https://127.0.0.1:3000/api/
</Location>

12. Make sure to run the following command for proxy_http to work

Run sudo a2enmod proxy_http

References and Error Messages


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *