Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 1.35 KB

File metadata and controls

41 lines (31 loc) · 1.35 KB

Setup on apache server

https://jupyterhub.readthedocs.io/en/stable/howto/configuration/config-proxy.html

  1. Enable the required apache modules:

    sudo a2enmod ssl rewrite proxy headers proxy_http proxy_wstunnel
  2. Add the folowing to your apache virtualhost configuration:

    RewriteEngine On
    RewriteCond %{HTTP:Connection} Upgrade [NC]
    RewriteCond %{HTTP:Upgrade} websocket [NC]
    RewriteRule /jhub/(.*) ws://127.0.0.1:8000/jhub/$1 [P,L]
    RewriteRule /jhub/(.*) http://127.0.0.1:8000/jhub/$1 [P,L]
    
    <Location "/jhub/">
      ProxyPreserveHost on
      ProxyPass         http://127.0.0.1:8000/jhub/
      ProxyPassReverse  http://127.0.0.1:8000/jhub/
      RequestHeader     set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
    </Location>
    <Location "/gradeservice/">
      ProxyPreserveHost on
      ProxyPass         http://127.0.0.1:5000/
      ProxyPassReverse  http://127.0.0.1:5000/
      RequestHeader     set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
    </Location>
  3. Uncomment the line c.JupyterHub.bind_url = "http://:8000/jhub" (line 38) in jupyter notebook config

  4. rebuild the jupyterhub container

  5. restart apache with sudo systemctl restart apache2