From c2c98fb440b371e075a7c5363e838dc62273fe56 Mon Sep 17 00:00:00 2001 From: 3wish Date: Thu, 11 Apr 2024 17:28:42 +0800 Subject: [PATCH] first commit --- nginx/Dockerfile | 2 ++ nginx/nginx.conf | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/nginx/Dockerfile b/nginx/Dockerfile index ecd10c6..7e264c7 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -1,2 +1,4 @@ FROM nginx EXPOSE 80 +COPY ./nginx.conf /etc/nginx/nginx.conf +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/nginx/nginx.conf b/nginx/nginx.conf index e69de29..beea96d 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -0,0 +1,49 @@ + +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + location /api { + rewrite ^/api/(.*)$ /$1 break; + proxy_pass http://together-backend:8000; + } + + location /static { + proxy_pass https://together-backend:8000; + } + } +}