1
0
Fork 0
ai-doc/src/WWW.tex

99 lines
2.8 KiB
TeX

%
% WWW.tex
%
% AI Documentation
%
% Copyright (C) 2022, 2023, Jeff Moe
%
% This document is licensed under the Creative Commons Attribution 4.0
% International Public License (CC BY-SA 4.0) by Jeff Moe.
%
\section{Introduction}
Below is one of the many ways to set up a web proxy.
It uses Apache, since that's what I've been using since the Usenet
patch era, but others can be used like nginx.
This sets up SSL cert with a registered domain, which is need to be
set up first. Example uses the domain ``ml0.deepcrayon.org''.
\begin{minted}{sh}
apt update
apt install apache2 python3-certbot-apache
a2enmod headers proxy proxy_http proxy_wstunnel rewrite ssl
a2ensite default-ssl 000-default
echo `hostname` > /var/www/html/index.html
systemctl restart apache2
certbot -d ml0.deepcrayon.org
systemctl restart apache2
# ComfyUI example:
vim /etc/apache2/sites-available/comfyui.conf
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
<FilesMatch "\.(?:cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule /(.*) ws://127.0.0.1:8188/$1 [P]
<Location />
ProxyPass http://127.0.0.1:8188/
</Location>
ServerName ml0.deepcrayon.org
SSLCertificateFile /etc/letsencrypt/live/ml0.deepcrayon.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/ml0.deepcrayon.org/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
#
# Stable Diffusion WebUI Example:
vim /etc/apache2/sites-available/sd-webui.conf
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
<FilesMatch "\.(?:cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule /(.*) ws://127.0.1.1:7860/$1 [P]
<Location />
ProxyPass http://127.0.1.1:7860/
</Location>
ServerName ml0.deepcrayon.org
SSLCertificateFile /etc/letsencrypt/live/ml0.deepcrayon.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/ml0.deepcrayon.org/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
#
systemctl restart apache2
# To disable Stable Diffusion example:
sudo a2dissite sd-webui.conf
# To enable ComfyUI example:
sudo a2ensite comfyui.conf
# Restart etc, after changes:
systemctl reload apache2
\end{minted}