首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Docker-proxy在linux mint 20上不起作用

Docker-proxy在linux mint 20上不起作用
EN

Stack Overflow用户
提问于 2020-08-08 12:28:18
回答 1查看 232关注 0票数 0

运行默认图像

代码语言:javascript
运行
复制
#  docker run -d --rm -p 8080:80 nginx

测试(linuxmint 20 | Docker版本19.03.12,build 48a66213fe):

代码语言:javascript
运行
复制
~# curl --verbose http://127.0.0.1:8080/todos
*   Trying 127.0.0.1:8080...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /todos HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/7.68.0
> Accept: */*
> 
* Empty reply from server
* Connection #0 to host 127.0.0.1 left intact
curl: (52) Empty reply from server

测试(macos 10.15.5 | Docker版本19.03.12,build 48a66213fe):

代码语言:javascript
运行
复制
curl --verbose http://127.0.0.1:8080/todos
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /todos HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/7.64.1
> Accept: */*
> 
< HTTP/1.1 404 Not Found
< Server: nginx/1.19.1
< Date: Sat, 08 Aug 2020 04:20:15 GMT
< Content-Type: text/html
< Content-Length: 153
< Connection: keep-alive
< 
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.19.1</center>
</body>
</html>
* Connection #0 to host 127.0.0.1 left intact
* Closing connection 0

按照说明安装:https://docs.docker.com/engine/install/ubuntu/

你能告诉我怎么修吗?

EN

回答 1

Stack Overflow用户

发布于 2020-08-09 17:40:02

默认情况下,Nginx没有定义url curl --verbose http://127.0.0.1:8080/todos

Docker proxy正在工作,因为curl --verbose http://127.0.0.1:8080应该可以工作,将你的主机localhost :8080连接到容器内部的nginx :80。

404并不意味着docker-proxy不工作,但在docker配置中找不到url。也许你有一个你没有添加到nginx中的web代码,或者你错过了一些nginx配置。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63311808

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档