简体   繁体   English

"docker compose nginx代理不重定向"

[英]docker compose nginx proxy not redirecting

I have an Ubuntu server and have built an nginx proxy in one docker container and an nginx webserver in an other container and they are both in the same network and can see each other, but the proxy doesn't redirect to the webserver and I always get this error when accessing my website:我有一个 Ubuntu 服务器,并在一个 docker 容器中构建了一个 nginx 代理,在另一个容器中构建了一个 nginx 网络服务器,它们都在同一个网络中并且可以互相看到,但是代理不会重定向到网络服务器,我总是访问我的网站时出现此错误:

proxy      | 2018/09/05 15:30:27 [alert] 8#8: 1024 worker_connections are not enough
proxy      | 2018/09/05 15:30:27 [error] 8#8: *4086 upstream prematurely closed connection while reading response header from upstream, client: 172.18.0.1, server: , request: "GET / HTTP/1.0", upstream: "http://XX.XX.XX.XX:80/", host: "test.com"

I just realised, I did redirect my proxy container to itself, fixed it now ^^ 我刚意识到,我确实将我的代理容器重定向到了它自己,现在修复了它^^

Dockerfile proxy Dockerfile代理

server {
  listen 80;
  server_name proxy;

  location / {
      proxy_pass http://website/
  }
}

Dockerfile nginx webserver Dockerfile Nginx Web服务器

server {
    server_name website;
    root /usr/share/nginx/html;
    index index.php;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM