分享

如何解决Ollama上的连接问题或需要更新

 netouch 2024-05-19 发布于北京

在ubuntu上安装WebUI后,我收到“Ollama版本:未检测到”和“打开WebUI:服务器连接错误”,其中:

sudo docker run -d -p 3000:8080 -e OLLAMA_API_BASE_URL=http://host.ernal:11434/api --add-host=host.ernal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main

继续设置>常规>Ollama api url我有:http://localhost:11434/api

跑步Ollama serve给了我:

Error: listen tcp 127.0.0.1:11434: bind: address already in use

去http://127.0.0.1:11434/我得到提示:Ollama is running去http://localhost:11434/api给了我:404 not found但去http://localhost:11434/api/version给我:version: '0.1.25'我也做了sudo ufw disable以确保这不是防火墙问题

我试过这样做:https://github.com/ollama/ollama/blob/main/docs/faq.md#setting-environment-variables-on-linux这样做sudo systemctl edit ollama.service会给我一个文件,如下所示:

### Editing /etc/systemd/system/ollama.service.d/override.conf ### Anything between here and the comment below will become the new contents of the file [Unit] Environment='OLLAMA_HOST=0.0.0.0:11434' Environment='OLLAMA_ORIGINS=*' ### Lines below this comment will be discarded ### /etc/systemd/system/ollama.service # [Unit] # Description=Ollama Service # After=network-online.target # # [Service] # ExecStart=/usr/local/bin/ollama serve # User=ollama # Group=ollama # Restart=always # RestartSec=3 # Environment='PATH=/home/myuser/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin' # # [Install] # WantedBy=default.target

我还尝试过:

sudo docker stop open-webui
sudo docker rm -f open-webui
#variations of the install command

如果我使用卷曲:

同一网络上的不同设备卷曲curl http://192.168.y.x:11434/apicurl: (7) Failed to connect to 192.168.y.x port 11434: Connection refused

同一装置卷曲curl http://192.168.y.x:11434/api curl: (7) Failed to connect to 192.168.y.x port 11434 after 0 ms: Connection refused

同一装置卷曲curl http://127.0.0.1:11434/api 404 page not found

Curl inside docker docker exec -it open-webui sh:

curl http://192.168.y.x:11434/api -> curl: (7) Failed to connect to 192.168.y.x port 11434 after 0 ms: Couldn't connect to server
curl http://127.0.0.1:11434/api -> curl: (7) Failed to connect to 127.0.0.1 port 11434 after 0 ms: Couldn't connect to server
curl http://host.ernal/api ->

<!DOCTYPE HTML PUBLIC '-//IETF//DTD HTML 2.0//EN'> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL was not found on this server.</p> <hr> <address>Apache/2.4.52 (Ubuntu) Server at host.ernal Port 80</address> </body></html>

有人能告诉我该怎么做才能解决这个问题吗?

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多