Added: Changed Nginx
This commit is contained in:
@@ -1,43 +1,44 @@
|
||||
# Shared proxy headers
|
||||
include /etc/nginx/snippets/proxy-headers.conf;
|
||||
|
||||
# nginx/conf.d/jupyterhub.conf
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
|
||||
listen 80;
|
||||
server_name _; # Respond to all hostnames
|
||||
|
||||
# JupyterHub with base URL /jupyter/
|
||||
location /jupyter/ {
|
||||
proxy_pass http://jupyterhub:8000/; # Docker service name
|
||||
proxy_pass http://jupyterhub:8000/jupyter/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# Apply shared proxy headers
|
||||
include /etc/nginx/snippets/proxy-headers.conf;
|
||||
|
||||
# Special WebSocket timeout
|
||||
# WebSocket support (crucial for Jupyter)
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_read_timeout 86400;
|
||||
|
||||
# Handle large file uploads
|
||||
client_max_body_size 100M;
|
||||
proxy_request_buffering off;
|
||||
}
|
||||
|
||||
# Redirect /jupyter to /jupyter/
|
||||
location = /jupyter {
|
||||
# Redirect root to JupyterHub
|
||||
location = / {
|
||||
return 302 /jupyter/;
|
||||
}
|
||||
|
||||
|
||||
# Stativ site conf
|
||||
root /var/www/static;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
# Cache static assets
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, no-transform";
|
||||
# Health check endpoint
|
||||
location /jupyter/hub/health {
|
||||
proxy_pass http://jupyterhub:8000/jupyter/hub/health;
|
||||
proxy_set_header Host $host;
|
||||
access_log off;
|
||||
allow all;
|
||||
}
|
||||
|
||||
# Deny access to hidden files
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user