From 6417e896ae25d264ad3d871769d80bbe51141d75 Mon Sep 17 00:00:00 2001 From: PuneetPunamiya Date: Wed, 27 Apr 2022 19:03:38 +0530 Subject: [PATCH] Split the nginx.conf by separating locations directive This will split the nginx.conf file by separating the locations directive into another file and including in nginx.conf This is to make it work with images like `registry.access.redhat.com/ubi8/nginx-120` where the nginx.conf is present and only locations directive is required Also updates the UI dockerfile to copy the new file Signed-off-by: Puneet Punamiya --- images/ui.Dockerfile | 1 + ui/image/location.locations | 8 ++++++++ ui/image/nginx.conf | 12 ++---------- 3 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 ui/image/location.locations diff --git a/images/ui.Dockerfile b/images/ui.Dockerfile index 30f600ab52..dce2206217 100644 --- a/images/ui.Dockerfile +++ b/images/ui.Dockerfile @@ -24,5 +24,6 @@ USER nginx EXPOSE 8080 COPY ui/image/nginx.conf /etc/nginx/conf.d/default.conf +COPY ui/image/location.locations /etc/nginx/conf.d/location.locations CMD /usr/bin/start.sh diff --git a/ui/image/location.locations b/ui/image/location.locations new file mode 100644 index 0000000000..e2981db056 --- /dev/null +++ b/ui/image/location.locations @@ -0,0 +1,8 @@ +location / { + index index.html index.htm; + try_files $uri /index.html; +} + +error_page 500 502 503 504 /50x.html; +location = /50x.html { +} diff --git a/ui/image/nginx.conf b/ui/image/nginx.conf index 98e54811dc..dc0e928e57 100644 --- a/ui/image/nginx.conf +++ b/ui/image/nginx.conf @@ -1,24 +1,16 @@ server { listen 8080; server_name localhost; + root /usr/share/nginx/html; #charset koi8-r; #access_log /var/log/nginx/host.access.log main; - location / { - root /usr/share/nginx/html; - index index.html index.htm; - try_files $uri /index.html; - } + include /etc/nginx/conf.d/location.locations; #error_page 404 /404.html; # redirect server error pages to the static page /50x.html - # - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; - } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 #