【发布时间】:2018-10-10 09:13:10
【问题描述】:
我在使用 nginx 时遇到了一个小问题。首先,我只是将 nginx 和 portainer 作为容器运行。 Portainer 在端口 9000 上运行,并且容器位于同一个 docker 网络上,因此这不是可见性问题。 Nginx 暴露了 80 端口并且工作正常。直接访问9000时portainer也是如此。我在本地映射 nginx 卷 /etc/nginx/nginx.conf:ro 和 /usr/share/nginx/html:ro 并且它们对更改做出反应,所以我应该正确连接。在我映射的 nginx.conf(http 部分)中,我有
server {
location /portainer {
proxy_pass http://portainer:9000;
}
}
portainer 被命名的地方,好吧,portainer。我也尝试过使用上游指令+服务器,但也没有用。
当访问 localhost/porttainer 日志时 nginx 显示
2018/04/30 09:21:32 [错误] 7#7: *1 open() "/usr/share/nginx/html/porttainer" 失败(2:没有这样的文件或目录),客户端: 172.18.0.1,服务器:localhost,请求:“GET /portainer HTTP/1.1”,主机:“localhost”
这表明位置指令甚至没有命中(?)。我在各个地方都尝试过,但无济于事。我猜这是我缺少的一些微不足道的东西。
提前致谢, 尼克
【问题讨论】: