Jupyter notebook on AWS with NGINX
We managed to get Jupyter notebook up in the cloud on AWS in this previous post.
Jupyter notebook on AWS with NGINX
We managed to get Jupyter notebook up in the cloud on AWS in this previous post.
However, it’s not really sustainable to have to keep adding the port 8888 at the end of the URL.
We shall add Nginx to the mix. Nginx is a HTTP server, which will allow us to redirect HTTP and HTTPS requests alike to the local server on port 8888.
Nginx
First, we install Nginx. SSH in as per the previous post.
sudo apt-get update
sudo apt-get install nginxOnce Nginx is installed, add the configuration file at /etc/nginx/conf.d/
nano sudo /etc/nginx/conf.d/configuration.confCopy and paste the lines below.
upstream notebook {
server localhost:8888;
}
server {
listen 80;
listen 443;
ssl on;
server_name 54.213.41.70;
ssl_certificate /home/ubuntu/certs/mycert.pem;
ssl_certificate_key /home/ubuntu/certs/mycert.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
access_log /home/ubuntu/logs/nginx.access.log;
error_log /home/ubuntu/logs/nginx.error.log;
location / {
proxy_pass https://notebook;
proxy_set_header Host $host;
}
location ~ /api/kernels/ {
proxy_pass https://notebook;
proxy_set_header Host $host;
# websocket support
proxy_http_version 1.1;
proxy_set_header Upgrade "websocket";
proxy_set_header Connection "Upgrade";
proxy_read_timeout 86400;
}
}This will neatly bring us via HTTPS from /notebook to the localhost:8888.
We need to first restart Nginx though.
sudo service nginx restartAnd that’s it.
playgrd.com || facebook.com/playgrdstar || instagram.com/playgrdstar/


