CoolFace
Apppublic

beea/open-webui

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
apache.md200 linesDownload Raw Back to docs
1# Hosting UI and Models separately2 3Sometimes, its beneficial to host Ollama, separate from the UI, but retain the RAG and RBAC support features shared across users:4 5# Open WebUI Configuration6 7## UI Configuration8 9For the UI configuration, you can set up the Apache VirtualHost as follows:10 11```12# Assuming you have a website hosting this UI at "server.com"13<VirtualHost 192.168.1.100:80>14    ServerName server.com15    DocumentRoot /home/server/public_html16 17    ProxyPass / http://server.com:3000/ nocanon18    ProxyPassReverse / http://server.com:3000/19 20</VirtualHost>21```22 23Enable the site first before you can request SSL:24 25`a2ensite server.com.conf` # this will enable the site. a2ensite is short for "Apache 2 Enable Site"26 27```28# For SSL29<VirtualHost 192.168.1.100:443>30    ServerName server.com31    DocumentRoot /home/server/public_html32 33    ProxyPass / http://server.com:3000/ nocanon34    ProxyPassReverse / http://server.com:3000/35 36    SSLEngine on37    SSLCertificateFile /etc/ssl/virtualmin/170514456861234/ssl.cert38    SSLCertificateKeyFile /etc/ssl/virtualmin/170514456861234/ssl.key39    SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.140 41    SSLProxyEngine on42    SSLCACertificateFile /etc/ssl/virtualmin/170514456865864/ssl.ca43</VirtualHost>44 45```46 47I'm using virtualmin here for my SSL clusters, but you can also use certbot directly or your preferred SSL method. To use SSL:48 49### Prerequisites.50 51Run the following commands:52 53`snap install certbot --classic`54`snap apt install python3-certbot-apache` (this will install the apache plugin).55 56Navigate to the apache sites-available directory:57 58`cd /etc/apache2/sites-available/`59 60Create server.com.conf if it is not yet already created, containing the above `<virtualhost>` configuration (it should match your case. Modify as necessary). Use the one without the SSL:61 62Once it's created, run `certbot --apache -d server.com`, this will request and add/create an SSL keys for you as well as create the server.com.le-ssl.conf63 64# Configuring Ollama Server65 66On your latest installation of Ollama, make sure that you have setup your api server from the official Ollama reference:67 68[Ollama FAQ](https://github.com/jmorganca/ollama/blob/main/docs/faq.md)69 70### TL;DR71 72The guide doesn't seem to match the current updated service file on linux. So, we will address it here:73 74Unless when you're compiling Ollama from source, installing with the standard install `curl https://ollama.com/install.sh | sh` creates a file called `ollama.service` in /etc/systemd/system. You can use nano to edit the file:75 76```77sudo nano /etc/systemd/system/ollama.service78```79 80Add the following lines:81 82```83Environment="OLLAMA_HOST=0.0.0.0:11434" # this line is mandatory. You can also specify84```85 86For instance:87 88```89[Unit]90Description=Ollama Service91After=network-online.target92 93[Service]94ExecStart=/usr/local/bin/ollama serve95Environment="OLLAMA_HOST=0.0.0.0:11434" # this line is mandatory. You can also specify 192.168.254.109:DIFFERENT_PORT, format96Environment="OLLAMA_ORIGINS=http://192.168.254.106:11434,https://models.server.city" # this line is optional97User=ollama98Group=ollama99Restart=always100RestartSec=3101Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/s>102 103[Install]104WantedBy=default.target105```106 107Save the file by pressing CTRL+S, then press CTRL+X108 109When your computer restarts, the Ollama server will now be listening on the IP:PORT you specified, in this case 0.0.0.0:11434, or 192.168.254.106:11434 (whatever your local IP address is). Make sure that your router is correctly configured to serve pages from that local IP by forwarding 11434 to your local IP server.110 111# Ollama Model Configuration112 113## For the Ollama model configuration, use the following Apache VirtualHost setup:114 115Navigate to the apache sites-available directory:116 117`cd /etc/apache2/sites-available/`118 119`nano models.server.city.conf` # match this with your ollama server domain120 121Add the folloing virtualhost containing this example (modify as needed):122 123```124 125# Assuming you have a website hosting this UI at "models.server.city"126<IfModule mod_ssl.c>127    <VirtualHost 192.168.254.109:443>128        DocumentRoot "/var/www/html/"129        ServerName models.server.city130        <Directory "/var/www/html/">131            Options None132            Require all granted133        </Directory>134 135        ProxyRequests Off136        ProxyPreserveHost On137        ProxyAddHeaders On138        SSLProxyEngine on139 140        ProxyPass / http://server.city:1000/ nocanon # or port 11434141        ProxyPassReverse / http://server.city:1000/ # or port 11434142 143        SSLCertificateFile /etc/letsencrypt/live/models.server.city/fullchain.pem144        SSLCertificateKeyFile /etc/letsencrypt/live/models.server.city/privkey.pem145        Include /etc/letsencrypt/options-ssl-apache.conf146    </VirtualHost>147</IfModule>148```149 150You may need to enable the site first (if you haven't done so yet) before you can request SSL:151 152`a2ensite models.server.city.conf`153 154#### For the SSL part of Ollama server155 156Run the following commands:157 158Navigate to the apache sites-available directory:159 160`cd /etc/apache2/sites-available/`161`certbot --apache -d server.com`162 163```164<VirtualHost 192.168.254.109:80>165    DocumentRoot "/var/www/html/"166    ServerName models.server.city167    <Directory "/var/www/html/">168        Options None169        Require all granted170    </Directory>171 172    ProxyRequests Off173    ProxyPreserveHost On174    ProxyAddHeaders On175    SSLProxyEngine on176 177    ProxyPass / http://server.city:1000/ nocanon # or port 11434178    ProxyPassReverse / http://server.city:1000/ # or port 11434179 180    RewriteEngine on181    RewriteCond %{SERVER_NAME} =models.server.city182    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]183</VirtualHost>184 185```186 187Don't forget to restart/reload Apache with `systemctl reload apache2`188 189Open your site at https://server.com!190 191**Congratulations**, your _**Open-AI-like Chat-GPT style UI**_ is now serving AI with RAG, RBAC and multimodal features! Download Ollama models if you haven't yet done so!192 193If you encounter any misconfiguration or errors, please file an issue or engage with our discussion. There are a lot of friendly developers here to assist you.194 195Let's make this UI much more user friendly for everyone!196 197Thanks for making open-webui your UI Choice for AI!198 199This doc is made by **Bob Reyes**, your **Open-WebUI** fan from the Philippines.200