From e97edbbd8169b9308ab0e20f4ca62d86d949b749 Mon Sep 17 00:00:00 2001 From: Harold Ye <68500948+Harold-y@users.noreply.github.com> Date: Sat, 24 Feb 2024 15:51:45 -0500 Subject: [PATCH] fix nginx refresh 404 issue --- README.md | 6 +++++- photoly_frontend_vue/Dockerfile | 2 ++ photoly_frontend_vue/nginx.conf | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 photoly_frontend_vue/nginx.conf diff --git a/README.md b/README.md index a9e17fa..b471d5f 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,11 @@ Frontend: Vue3 (new version of frontend) + Naive UI root@cbr-gov-frostland1-dev:/test/photoly$ > docker-compose up ``` -*Note: the initial MySQL will take longer to execute the initialization ("photoly\database\mysql-dump"), and the data will persist to ("photoly\database\mysql-data"). Redis data (login tokens) do not persist because we don't have to. In the docker-compose.yml file and two Dockerfiles inside photoly_backend and photoly_frontend_vue, we have defined (hardcoded) the ports, names, etc. so if you just want to conveniently run the photoly, try not to change these settings. However, if you decide to change some settings, make sure to go over photoly_backend\src\main\resources\application.properties, photoly_frontend_vue\.env, photoly_backend\Dockerfile, photoly_frontend_vue\Dockerfile, and .\docker-compose.yml. +*Note: the initial MySQL will take longer to execute the initialization ("photoly\database\mysql-dump"), and the data will persist to ("photoly\database\mysql-data"). Redis data (login tokens) do not persist because we don't have to. In the docker-compose.yml file and two Dockerfiles inside photoly_backend and photoly_frontend_vue, we have defined (hardcoded) the ports, names, etc. so if you just want to conveniently run the photoly, try not to change these settings. + + + +However, if you decide to change some settings, make sure to go over photoly_backend\src\main\resources\application.properties, photoly_frontend_vue\.env, photoly_backend\Dockerfile, photoly_frontend_vue\Dockerfile, photoly_frontend_vue\nginx_conf, and .\docker-compose.yml. ### Normal VM/Host Version diff --git a/photoly_frontend_vue/Dockerfile b/photoly_frontend_vue/Dockerfile index ba500e5..3e9e2af 100644 --- a/photoly_frontend_vue/Dockerfile +++ b/photoly_frontend_vue/Dockerfile @@ -14,4 +14,6 @@ RUN rm -rf ./* COPY --from=builder /app/dist . +COPY ./nginx.conf /etc/nginx/conf.d/default.conf + ENTRYPOINT ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/photoly_frontend_vue/nginx.conf b/photoly_frontend_vue/nginx.conf new file mode 100644 index 0000000..a62b883 --- /dev/null +++ b/photoly_frontend_vue/nginx.conf @@ -0,0 +1,8 @@ + +server { + location / { + root /usr/share/nginx/html/; + index index.html; + try_files $uri $uri/ /index.html; + } +} \ No newline at end of file