docker 安裝
# Add Docker's official GPG key:
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/debian
Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl status docker
sudo systemctl start docker
sudo systemctl enable --now docker
安裝 Ollama
apt install -y zstd
curl -fsSL https://ollama.com/install.sh | bash
ollama --version
mv /usr/share/ollama /usr/share/ollama.bak
ln -s /home/ollama/ /usr/share/ollama
編輯 /etc/systemd/system/ollama.service 加入
[Service]
Environment="OLLAMA_HOST=0.0.0.0"
docker Open WebUI 設定
編輯 nginx.conf
server {
listen 80;
location /admin { return 403; }
location /api/v1/admin { return 403; }
location /api/v1/auth/update { return 403 "Action Denied: Profile updates are disabled."; }
location /api/v1/users { return 403 "Action Denied."; }
if ($request_method = DELETE) {
return 403 "Delete operations are strictly prohibited on this server.";
}
location /api/models {
if ($request_method = DELETE) { return 403; }
proxy_pass http://open-webui:8080;
}
location / {
proxy_pass http://open-webui:8080;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
編輯docker-compose.yml
services:
nginx-proxy:
image: nginx:alpine
container_name: nginx-proxy
ports:
- "3000:80"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- open-webui
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
environment:
- "WEBUI_AUTH=False"
- "OLLAMA_BASE_URL=http://host.docker.internal:11434"
- "DEFAULT_USER_ROLE=user"
- "ENABLE_ADMIN_EXPORT=False"
- "SHOW_ADMIN_DETAILS=False"
- "ENABLE_MODEL_CHANGES=False"
- "ENABLE_PERSISTENT_CONFIG=False"
- "ENABLE_COMMUNITY_SHARING=False"
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- open-webui-data:/app/backend/data
restart: always
volumes:
open-webui-data:
docker compose up -d
相關指令
docker stop open-webui
docker rm open-webui
docker volume rm open-webui
docker volume rm docker_open-webui-data
docker volume rm open-webui-data
docker stop nginx-proxy;docker rm nginx-proxy
沒有留言:
張貼留言