From c054da9d0dfb1195922bec350ae4c39adae60dfb Mon Sep 17 00:00:00 2001 From: Suriya Date: Sat, 6 Jun 2026 12:33:04 +0530 Subject: [PATCH] Fix nginx configuration override --- Dockerfile | 4 ++-- nginx.conf | 23 ++++++++--------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 06927f0..cc5b7dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,8 +10,8 @@ RUN rm -rf ./* # NOTE: If your folder is named "dist" instead of "build", change "build/" to "dist/" COPY dist/ . -# 3. Copy your custom Nginx configuration (which you already have in your log) -COPY nginx.conf /etc/nginx/nginx.conf +# 3. Copy your custom Nginx configuration to override the default server block +COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 diff --git a/nginx.conf b/nginx.conf index f1a121b..4aae99b 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,18 +1,11 @@ -events {} +server { + listen 80; + server_name localhost; -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - server { - listen 80; - server_name localhost; - - location / { - root /usr/share/nginx/html; - index index.html index.htm; - # This line forces Nginx to pass routing back to React Router - try_files $uri $uri/ /index.html; - } + location / { + root /usr/share/nginx/html; + index index.html index.htm; + # This line forces Nginx to pass routing back to React Router + try_files $uri $uri/ /index.html; } }