当前位置: 首页 > news >正文

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

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

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

ssh -CNg -L 0.0.0.0:11434:127.0.0.1:11434 root@connect.westb.seetacloud.com -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 结果:没有任何返回内容

## 请帮忙分析原因。

http://www.dtcms.com/a/59827.html

相关文章:

  • 基于SpringBoot的智能问诊系统设计与隐私保护策略
  • ChatGPT使用经验分享
  • Android MVC、MVP、MVVM三种架构的介绍和使用。
  • 蓝桥杯 C++ b组 积木画深度解析
  • 【算法day4】最长回文子串——动态规划方法
  • JAVA通过SSE实现消息推送
  • 【Elasticsearch入门到落地】9、hotel数据结构分析
  • SAP监控体系和机制
  • 【Go每日一练】统计字符出现的次数
  • 【python爬虫】酷狗音乐爬取练习
  • Manus详细介绍
  • 复现 MODEST 机器人抓取透明物体 单目 ICRA 2025
  • 【编译器】VSCODE编译C语言
  • 如是APP:AI精准匹配需求,信用体系重构信任,双轮驱动打造无套路电商
  • 将本地已有的项目上传至仓库
  • 第七章:go 切片
  • 对开源VLA sota π0的微调——如何基于各种开源数据集、以及你自己的私有数据集微调π0(含我司的微调实践)
  • 数据结构(回顾)
  • 深度学习算法实战——风格迁移(主页有源码)
  • 开发指南107-谷歌内核浏览器滚动条设置
  • 开发过程中遇到的问题记录
  • 011---UART协议的基本知识(一)
  • Tensorflow 2.0 GPU的使用与限制使用率及虚拟多GPU
  • 计算机视觉算法实战——野猪检测(主页有源码)
  • 【2025年27期免费获取股票数据API接口】实例演示五种主流语言获取股票行情api接口之沪深A股跌停股池数据获取实例演示及接口API说明文档
  • 虚函数和虚表的原理是什么?
  • Deepseek中的MoE架构的改造:动态可变参数激活的MoE混合专家架构(DVPA-MoE)的考虑
  • 【算法day5】最长回文子串——马拉车算法
  • 静态网页的爬虫(以电影天堂为例)
  • Git学习笔记(二)