This VM comes with the JupyterHub running on http. Follow below steps to enable HTTPS for your JupyterHub :
cd /home/ubuntu/setup
Note: Below step is for generating self signed certificate. If you have SSL certificate signed from Certificate Authority, copy the certificate and key in the vm under /home/ubuntu/setup/internal-ssl/hub-ca/ folder with the names hub-ca.crt and hub-ca.key respectively and skip to the per-boot editing step below.
Generate auto sign certificate by running below command. This will generate hub-ca.crt and hub-ca.key files under /home/ubuntu/setup/internal-ssl/hub-ca/ directory.
jupyterhub --generate-certs
sudo sed -i 's|sudo jupyterhub --config /home/ubuntu/setup/jupyterhub_config.py --ip 0.0.0.0 --port 80|#sudo jupyterhub --config /home/ubuntu/setup/jupyterhub_config.py --ip 0.0.0.0 --port 80|g' /var/lib/cloud/scripts/per-boot/jupyter_perboot.sh
sudo sed -i 's|#sudo jupyterhub --config /home/ubuntu/setup/jupyterhub_config.py --port 443|sudo jupyterhub --config /home/ubuntu/setup/jupyterhub_config.py --port 443|g' /var/lib/cloud/scripts/per-boot/jupyter_perboot.sh
For Azure: https://blogs.msdn.microsoft.com/pkirchner/2016/02/02/allow-incoming-web-traffic-to-web-server-in-azure-vm/(the link for enabling port 8080. You should provide 443 as the value and not 8080)
For GCP: Open the VM page from GCP console, click on edit and select “https” option and save as shown below:
sudo init 6
Note: Chrome browser doesn’t add security exception for self signed certificate and will give you error message as shown below. Please use Firefox Browser to access Jupyterhub WebUI.