I have a server (Ubuntu 20) running NGINX for reverse proxy. I have a Django app accessible thru the the https://URL/app
location, and it's static content is aliased at /var/www/static-collected
. This works fine.
I'm attempting to setup Jupyter Lab at https://URL/jupyter
, but it's unable to find the /static
content, ie the CSS and images (Jupyter logo). I've setup Jupyter Lab with NGINX plenty of times, but never with another app that is using /static
.
I've tried copying the Jupyter static files (located @ .../dist-packages/jupyter_server/static
) to the static location used by the Django app, thinking Jupyter would look there given the NGINX setup.
I've also tried editing the c.LabServerApp.static_dir
property in the config to point directly at the Jupyter static files but no luck so far.
I'm not sure if this should be solved thru NGINX config, Jupyter config, or both. Any ideas would be appreciated!
Here's my NGINX config:
server {
root /var/www/html;
server_name URL; # managed by Certbot
location /jupyter/ {
proxy_pass http://localhost:8888/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
}
location /app/ {
proxy_pass http://localhost:8000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /static/ {
alias /var/www/static-collected/;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate ...; # managed by Certbot
ssl_certificate_key ...; # managed by Certbot
include ...; # managed by Certbot
ssl_dhparam ...; # managed by Certbot
}
server {
if ($host = URL) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 ;
listen [::]:80 ;
server_name URL;
return 404; # managed by Certbot
}