Last active
August 31, 2024 17:25
-
-
Save manics/9fcfcd545e328ad1f3d4008a0aa7a2ce to your computer and use it in GitHub Desktop.
Example of using JupyterHub with an Apache proxy under a prefix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example of using JupyterHub with an Apache proxy under a prefix | |
version: "3" | |
services: | |
jhub: | |
image: quay.io/jupyterhub/jupyterhub-demo:5.1.0 | |
networks: | |
- jhub | |
volumes: | |
- "./jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py:ro,z" | |
httpd: | |
image: docker.io/library/httpd:2.4 | |
networks: | |
- jhub | |
ports: | |
- "8080:80" | |
- "8443:443" | |
volumes: | |
- "./httpd.conf:/usr/local/apache2/conf/httpd.conf:ro,z" | |
- "./selfsigned-cert.pem:/etc/certs/selfsigned-cert.pem:ro,z" | |
- "./selfsigned-key.pem:/etc/certs/selfsigned-key.pem:ro,z" | |
networks: | |
jhub: | |
name: jhub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ServerRoot "/usr/local/apache2" | |
Listen 80 | |
Listen 443 | |
LoadModule mpm_event_module modules/mod_mpm_event.so | |
LoadModule authn_file_module modules/mod_authn_file.so | |
LoadModule authn_core_module modules/mod_authn_core.so | |
LoadModule authz_host_module modules/mod_authz_host.so | |
LoadModule authz_core_module modules/mod_authz_core.so | |
LoadModule mime_module modules/mod_mime.so | |
LoadModule headers_module modules/mod_headers.so | |
LoadModule proxy_module modules/mod_proxy.so | |
LoadModule proxy_http_module modules/mod_proxy_http.so | |
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so | |
LoadModule ssl_module modules/mod_ssl.so | |
LoadModule unixd_module modules/mod_unixd.so | |
LoadModule status_module modules/mod_status.so | |
LoadModule rewrite_module modules/mod_rewrite.so | |
<IfModule unixd_module> | |
User www-data | |
Group www-data | |
</IfModule> | |
ServerAdmin [email protected] | |
ServerName localhost | |
<Directory /> | |
AllowOverride none | |
Require all denied | |
</Directory> | |
DocumentRoot "/usr/local/apache2/htdocs" | |
<Directory "/usr/local/apache2/htdocs"> | |
Options Indexes FollowSymLinks | |
Require all granted | |
</Directory> | |
ErrorLog /proc/self/fd/2 | |
LogLevel info | |
# Configure SSL | |
SSLEngine on | |
SSLCertificateFile /etc/certs/selfsigned-cert.pem | |
SSLCertificateKeyFile /etc/certs/selfsigned-key.pem | |
# Use RewriteEngine to handle WebSocket connection upgrades | |
RewriteEngine On | |
RewriteCond %{HTTP:Connection} Upgrade [NC] | |
RewriteCond %{HTTP:Upgrade} websocket [NC] | |
RewriteRule /jhub/(.*) ws://jhub:9000/jhub/$1 [P,L] | |
RewriteRule /jhub/(.*) http://jhub:9000/jhub/$1 [P,L] | |
<Location "/jhub/"> | |
ProxyPreserveHost on | |
ProxyPass http://jhub:9000/jhub/ | |
ProxyPassReverse http://jhub:9000/jhub/ | |
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME} | |
</Location> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c.JupyterHub.authenticator_class = "dummy" | |
c.JupyterHub.spawner_class = "simple" | |
c.JupyterHub.bind_url = "http://0.0.0.0:9000/jhub/" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----BEGIN CERTIFICATE----- | |
MIIDCTCCAfGgAwIBAgIUHrK4/l2WRZT6daHOnsjIhvG3fFgwDQYJKoZIhvcNAQEL | |
BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTI0MDgzMTE2MjM0OVoXDTI1MDgz | |
MTE2MjM0OVowFDESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEF | |
AAOCAQ8AMIIBCgKCAQEAsVfLtH+ImNTIuqgYZ0eWpo65cV290S9ZB+yqHlT1KB9j | |
eodvPFvWiBcwrYgzxOsUdKUFMSZqoMlnCMtZJlb+7QeibKezDg77AMKjwfK2fJRc | |
ey2ozpuTsNwowiFXk5pJUn3mTFp+S3sWvLMURtzTmzV6enjL+UzoB7e72QZBNaCu | |
b/YHQXIjCcXhcI4srZN+tR5M8MYTPiadLPmvTcXxRjvK+BQvaxVIxiqkjolaHypl | |
kTC9vMt0ZdQJG6KZISyF5ZBf3XNL/8UzqCbp8Zgm01CsAncd4k5oNbzn6F5TrHeq | |
oaeWdWizQlppvXJl9wZx/atersDhw4UfP/K3+u/Z0wIDAQABo1MwUTAdBgNVHQ4E | |
FgQURRyeShnPgdh4BTURm3co5xbNIH4wHwYDVR0jBBgwFoAURRyeShnPgdh4BTUR | |
m3co5xbNIH4wDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAj7Bc | |
PXzTMMrT+MEYge52Nr2gzYj7PdLzy2udhpvGF93J01wxsEvZqKCW9wRhoPdh4WEg | |
Vz0UPhLE9cD2ydlHAkM5TYm81oooCNm3zjYWTExyJl2tpTlm4UyA8jnexMDeamIL | |
kFKob1OSeAXA8zkf10hrKaGM33L85HaYvXmirNgiasAUJbxKp011Vbsve5PDWrRw | |
NClaALm9zl6xUniWAh56Seuq/3aTAo5wY7nPC4BryC/AQ2v8PrcImCTn4IcwB0/O | |
7TbcjMcSzu98vNa2xXFOa6RqO3ZeFFfEdPK5y8su/vSShSAxXgbay29si9CWYIps | |
AhsedmXkk2LMs6Gi+w== | |
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----BEGIN PRIVATE KEY----- | |
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCxV8u0f4iY1Mi6 | |
qBhnR5amjrlxXb3RL1kH7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RbncZBxPdy0QmsiFUMNQZlOcSZM/vgw8rdTtwnrWWvBo7 | |
ZO7Ygc12U8twokNIS9CjKsLdbEyeMtxBtok0r6yl5KDJR3aevPWkdcHKV0PLNfy0 | |
B9w3zLgBf3zjoDfARvevdiPMAKzKvIzJhbVHRqmhch2S4b7lkBgqMt3yoQKBgQCJ | |
tQ/kPrZuz8tWojZxwBuyO6rcFLHDHyrWyoYaZuR4lFpCGAs9M7FCI3PZCpO+R6Ul | |
hs3lx9gc2M+ACBDxqiaBStzlWaCFWZP6dI2ocfCZH1k/7yipFtOo2F4hUr2u3bM8 | |
VI9B/nkyLjriXBzTg8ia9Dk+5bQP6Wj/8lB/8kjeTwKBgQDIKtPH9Ev6K4/HFkTz | |
QjOjilcK+lIo9eI3gLuzhB34Smc8PhP1wVNEiaMmSznXeps/K6R51kND2g/yghEx | |
xzwcAeUQMoxpgcEn6ymoAr9LISbcFbMBaf/FE8FvyDHq3wXIqBmdHmDINXUUBEv8 | |
2zfQZj2ZpzCuAN2asbdfThEoBw== | |
-----END PRIVATE KEY----- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment