Q:

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:
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"

Here are my files:
docker-compose.yml
version: '3'
networks:
    webnet:

services:
  proxy:
    build: ./proxy
    container_name: proxy
    networks:
      - webnet
    ports:
      - 80:80

  website:
    container_name: website
    build: ./nginx
    volumes:
      - ./config/default.conf:/etc/nginx/conf.d/
    networks:
      - webnet

Dockerfile proxy
FROM nginx
RUN rm /etc/nginx/nginx.conf

COPY proxy.conf /etc/nginx/nginx.conf

## proxy.conf

events {
  worker_connections 1024;
}

http {
        server {
                listen 80;
                server_name website;

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

Dockerfile nginx webserver
FROM nginx

RUN rm /usr/share/nginx/html/*
COPY test.com /usr/share/nginx/html

## nginx webserver default.conf
server {
    server_name test.com www.test.com;
    root /usr/share/nginx/html;
    index index.php;
}

A:

I just realised, I did redirect my proxy container to itself, fixed it now ^^
Dockerfile proxy
server {
  listen 80;
  server_name proxy;

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

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

