diff --git a/docker-compose.yaml b/docker-compose.yaml index 7ff2344..f513e52 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -28,6 +28,16 @@ services: else pnpm build && PORT=3001 node build --env-file=.env build; fi" + networks: + - web + + nginx: + build: ./nginx + depends_on: + - fastapi + - interex + expose: + - 80 environment: - VIRTUAL_HOST=interex.charlieavery.site - LETSENCRYPT_HOST=interex.charlieavery.site diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 0000000..062a4df --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:1.23.3-alpine-slim + +# replace nginx default with our new one +COPY ./default.conf /etc/nginx/conf.d/default.conf diff --git a/nginx/default.conf b/nginx/default.conf new file mode 100644 index 0000000..38f450e --- /dev/null +++ b/nginx/default.conf @@ -0,0 +1,19 @@ +upstream interex { + server interex:3001; # name of container in compose +} + +server { + listen 80; + server_name interex.charlieavery.site; + + location / { + proxy_pass http://interex; # from above + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } +}