Prosty vhost dla Pythona w Apache
Założenia:
aplikacje pythonowe to Jupyter Notebook, nasłuchujące na portach 8001-8012,
chcę mieć poszczególne notebooki jako „podkatalogi” python.baszarek.pl,
mam certyfikat z Let’s Encrypt.
VirtualHost *:80>
ServerName python.baszarek.pl:80
Redirect permanent / https://python.baszarek.pl/
</VirtualHost>
<VirtualHost *:443>
ServerName python.baszarek.pl:443
ServerAdmin root@localhost
# PreserveHost pomaga przy logowaniu
ProxyPreserveHost On
ProxyPass /errno http://127.0.0.1:8001/errno
ProxyPassReverse /errno http://127.0.0.1:8001/errno
ProxyPass /glob http://127.0.0.1:8002/glob
ProxyPassReverse /glob http://127.0.0.1:8002/glob
ProxyPass /math http://127.0.0.1:8003/math
ProxyPassReverse /math http://127.0.0.1:8003/math
ProxyPass /os http://127.0.0.1:8004/os
ProxyPassReverse /os http://127.0.0.1:8004/os
ProxyPass /pathlib http://127.0.0.1:8005/pathlib
ProxyPassReverse /pathlib http://127.0.0.1:8005/pathlib
ProxyPass /pickle http://127.0.0.1:8006/pickle
ProxyPassReverse /pickle http://127.0.0.1:8006/pickle
ProxyPass /random http://127.0.0.1:8007/random
ProxyPassReverse /random http://127.0.0.1:8007/random
ProxyPass /shutil http://127.0.0.1:8008/shutil
ProxyPassReverse /shutil http://127.0.0.1:8008/shutil
ProxyPass /subprocess http://127.0.0.1:8009/subprocess
ProxyPassReverse /subprocess http://127.0.0.1:8009/subprocess
ProxyPass /tkinter http://127.0.0.1:8010/tkinter
ProxyPassReverse /tkinter http://127.0.0.1:8010/tkinter
ProxyPass /zlib http://127.0.0.1:8011/zlib
ProxyPassReverse /zlib http://127.0.0.1:8011/zlib
ProxyPass /zoneinfo http://127.0.0.1:8012/zoneinfo
ProxyPassReverse /zoneinfo http://127.0.0.1:8012/zoneinfo
<Location /errno/api/kernels/>
ProxyPass ws://127.0.0.1:8001/errno/api/kernels/
ProxyPassReverse ws://127.0.0.1:8001/errno/api/kernels/
</Location>
<Location /errno/terminals/websocket/>
ProxyPass ws://localhost:8001/errno/terminals/websocket/
ProxyPassReverse ws://localhost:8001/errno/terminals/websocket/
</Location>
<Location /glob/api/kernels/>
ProxyPass ws://127.0.0.1:8002/glob/api/kernels/
ProxyPassReverse ws://127.0.0.1:8002/glob/api/kernels/
</Location>
<Location /glob/terminals/websocket/>
Więcej…
Oryginalny wpis: wiki:python_w_apache