Ollama在AutoDL部署,CPU服务器做代理,实践中

我有两台服务器,一台是GPU服务器,另一台是CPU服务器;

我在GPU服务器上安装了Ollama,然后通过命令映射端口到CPU服务器:

ssh -CNg -L 0.0.0.0:11434:127.0.0.1:11434 [email protected] -p 34016

映射成功了在Cpu服务器通过curl http://127.0.0.1:11434 可以看到响应内容:

Ollama is running

内网IP,也可以看到内容:

curl http://192.168.0.137:11434

我现在想通过nginx 代理下,把ollama服务开放到公网

server {

listen 80;

server_name ollama.guifanhua.com;

location / {

proxy_pass http://127.0.0.1:11434;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto $scheme;

}

}

域名解析是没问题的,但是公网无论如何都不能代理成功,在公网访问:http://ollama.guifanhua.com的时候报错

找不到 ollama.guifanhua.com 的网页

找不到与以下网址对应的网页:http://ollama.guifanhua.com/

HTTP ERROR 404

检查systemctl status firewalld:

Unit firewalld.service could not be found.

检查firewall-cmd --list-all返回:

public (active)

target: default

icmp-block-inversion: no

interfaces: eth0

sources:

services: dhcpv6-client ssh

ports:

protocols:

forward: yes

masquerade: no

forward-ports:

source-ports:

icmp-blocks:

rich rules:

检查getenforce 返回:

Disabled

telnet ollama.guifanhua.com 80

一直都是:正在连接ollama.guifanhua.com...

检查 netstat -tulpn | grep :80,返回:

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1565809/nginx: mast

tcp6 0 0 :::80 :::* LISTEN 1565809/nginx: mast

检查netstat -tulpn | grep :11434 返回:

tcp 0 0 0.0.0.0:11434 0.0.0.0:* LISTEN 1595287/ssh

检查80端口:firewall-cmd --permanent --add-port=80/tcp 返回:

success

firewall-cmd --reload 返回

success

检查域名解析:nslookup ollama.guifanhua.com

Server: 127.0.0.53

Address: 127.0.0.53#53

Non-authoritative answer:

Name: ollama.guifanhua.com

Address: 1.95.50.15

检查nginx状态 systemctl status nginx 返回:

nginx.service - A high performance web server and a reverse proxy server

Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)

Active: active (running) since Thu 2025-03-06 23:56:45 CST; 9h ago

Docs: man:nginx(8)

Main PID: 1565809 (nginx)

Tasks: 9 (limit: 18587)

Memory: 10.3M

CPU: 242ms

CGroup: /system.slice/nginx.service

├─1565809 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"

├─1594458 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

├─1594459 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

├─1594460 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

├─1594461 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

├─1594462 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

├─1594463 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

├─1594464 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

└─1594465 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

Mar 06 23:56:45 flexusx-f89b systemd[1]: Starting A high performance web server and a reverse proxy server...

Mar 06 23:56:45 flexusx-f89b systemd[1]: Started A high performance web server and a reverse proxy server.

检查nginx错误日志tail -f /var/log/nginx/error.log 返回:

2025/03/07 03:14:25 [error] 1565810#1565810: *299 connect() failed (111: Unknown error) while connecting to upstream, client: 123.249.97.106, server: ollama.guifanhua.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:11434/", host: "ollama.guifanhua.com", referrer: "https://www.baidu.com"

2025/03/07 08:34:39 [error] 1565810#1565810: *450 connect() failed (111: Unknown error) while connecting to upstream, client: 1.95.50.15, server: ollama.guifanhua.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:11434/", host: "ollama.guifanhua.com"

2025/03/07 08:34:48 [error] 1565810#1565810: *452 connect() failed (111: Unknown error) while connecting to upstream, client: 1.95.50.15, server: ollama.guifanhua.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:11434/", host: "ollama.guifanhua.com"

2025/03/07 08:34:59 [error] 1565810#1565810: *454 connect() failed (111: Unknown error) while connecting to upstream, client: 1.95.50.15, server: ollama.guifanhua.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:11434/", host: "ollama.guifanhua.com"

2025/03/07 08:43:32 [notice] 1594232#1594232: signal process started

2025/03/07 08:44:21 [notice] 1594260#1594260: signal process started

2025/03/07 08:47:49 [notice] 1594457#1594457: signal process started

检查nginx访问日志tail -f /var/log/nginx/access.log

199.45.154.135 - - [07/Mar/2025:09:05:37 +0800] "GET / HTTP/1.1" 200 3522 "-" "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)" "-"

199.45.154.135 - - [07/Mar/2025:09:05:53 +0800] "PRI * HTTP/2.0" 400 166 "-" "-" "-"

199.45.154.135 - - [07/Mar/2025:09:05:58 +0800] "GET /favicon.ico HTTP/1.1" 404 134 "-" "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)" "-"

199.45.154.135 - - [07/Mar/2025:09:06:00 +0800] "\x16\x03\x01\x00\xF7\x01\x00\x00\xF3\x03\x03*\x8B\xA8V\xBF?\xFB=\x89R\x02\xF5\xB5{\x9Ezg\xC16>\xDD\xCFG\x82\x82*\xFD\xBEZ\xE2u\x06 ^\xA8\x95\xE2\x0CQ\x95\x1Dc\x88\x96 \x89[\xFD\x89\x90\x83b\x8E\xBE=>\xEC.\xB2Z\x89P}\xEB\xCB\x00&\xCC\xA8\xCC\xA9\xC0/\xC00\xC0+\xC0,\xC0\x13\xC0\x09\xC0\x14\xC0" 400 166 "-" "-" "-"

194.165.16.163 - - [07/Mar/2025:09:06:26 +0800] "\x03\x00\x00/*\xE0\x00\x00\x00\x00\x00Cookie: mstshash=Administr" 400 166 "-" "-" "-"

211.94.136.254 - - [07/Mar/2025:09:10:12 +0800] "GET / HTTP/1.1" 404 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36" "-"

211.94.136.254 - - [07/Mar/2025:09:10:12 +0800] "GET / HTTP/1.1" 404 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36" "-"

211.94.136.254 - - [07/Mar/2025:09:10:13 +0800] "GET / HTTP/1.1" 404 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36" "-"

211.94.136.254 - - [07/Mar/2025:09:10:13 +0800] "GET / HTTP/1.1" 404 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36" "-"

211.94.136.254 - - [07/Mar/2025:09:10:13 +0800] "GET / HTTP/1.1" 404 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36" "-"

测试nginx配置curl -H "Host: ollama.guifanhua.com" http://localhost 结果:没有任何返回内容

请帮忙分析原因。

相关推荐
凯禾瑞华现代家政1 分钟前
适老化场景重构:现代家政老年照护虚拟仿真实训室建设方案
人工智能·系统架构·虚拟现实
Wnq100729 分钟前
通用人工智能 (AGI): 定义、挑战与未来展望
人工智能·agi
宋一诺3314 分钟前
机器学习——放回抽样
人工智能·机器学习
Ao00000041 分钟前
机器学习——主成分分析PCA
人工智能·机器学习
硅谷秋水1 小时前
Impromptu VLA:用于驾驶视觉-语言-动作模型的开放权重和开放数据
人工智能·机器学习·计算机视觉·语言模型·自动驾驶
TDengine (老段)1 小时前
TDengine 的 AI 应用实战——运维异常检测
大数据·数据库·人工智能·物联网·时序数据库·tdengine·涛思数据
jndingxin1 小时前
OpenCV CUDA模块霍夫变换------在 GPU 上执行概率霍夫变换检测图像中的线段端点类cv::cuda::HoughSegmentDetector
人工智能·opencv·计算机视觉
只有左边一个小酒窝1 小时前
(三)动手学线性神经网络:从数学原理到代码实现
人工智能·深度学习·神经网络
m0_726365831 小时前
2025年微信小程序开发:趋势、最佳实践与AI整合
人工智能·微信小程序·notepad++
jndingxin1 小时前
OpenCV CUDA模块图像处理------图像融合函数blendLinear()
图像处理·人工智能·opencv