From 7a2bee6fd59107c294899e4d2a5f2a7b8af4fe56 Mon Sep 17 00:00:00 2001 From: Saurabh Shrihar Date: Thu, 4 Apr 2024 16:50:40 +0400 Subject: [PATCH] Add nginx.conf file for handling cors --- Dockerfile | 5 ++++- nginx.conf | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile index 5795e5c..3ee97c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,10 @@ FROM nginx:alpine + +COPY nginx.conf /etc/nginx/nginx.conf + WORKDIR /usr/share/nginx/html COPY . . RUN rm -rf .git* EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..7fa36e6 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,27 @@ +# nginx.conf + +user nginx; +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + sendfile on; + keepalive_timeout 65; + + server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + add_header Access-Control-Allow-Origin *; + } + } +}