我对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 / portainer日志时,nginx显示
2018/04/30 09:21:32 [错误] 7#7:* 1 open()“/ usr / share / nginx / html / portainer”失败(2:没有这样的文件或目录),客户端:172.18.0.1 ,server:localhost,request:“GET / portainer HTTP / 1.1”,host:“localhost”
这表明location指令甚至没有被击中(?) . 我已尝试/在各个地方,但无济于事 . 我猜这是一件微不足道的事,我很想念 .
提前谢谢,Nik
2 回答
我不得不在两行中添加一个尾部斜杠:
试试这个:
参考:http://nginx.org/en/docs/http/ngx_http_core_module.html