From 03e582f30111dd9c28fee06f6f5dedc9e045bd2a Mon Sep 17 00:00:00 2001 From: Kendall Garner <17521368+kgarner7@users.noreply.github.com> Date: Wed, 18 Oct 2023 05:10:53 +0000 Subject: [PATCH] [feature]: support running feishin on custom path (#307) * [feature]: support running feishin on custom path * add details in readme --- .erb/configs/webpack.config.web.prod.ts | 2 +- Dockerfile | 5 +++-- README.md | 2 ++ nginx.conf => ng.conf.template | 5 ++--- 4 files changed, 8 insertions(+), 6 deletions(-) rename nginx.conf => ng.conf.template (88%) diff --git a/.erb/configs/webpack.config.web.prod.ts b/.erb/configs/webpack.config.web.prod.ts index 4a493acb..73cc32fc 100644 --- a/.erb/configs/webpack.config.web.prod.ts +++ b/.erb/configs/webpack.config.web.prod.ts @@ -38,7 +38,7 @@ const configuration: webpack.Configuration = { output: { path: webpackPaths.distWebPath, - publicPath: '/', + publicPath: 'auto', filename: 'renderer.js', library: { type: 'umd', diff --git a/Dockerfile b/Dockerfile index b5a50cf7..856af4d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,8 +10,9 @@ RUN npm run build:web # --- Production stage FROM nginx:alpine-slim -COPY --from=builder /app/release/app/dist/web /usr/share/nginx/html -COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --chown=nginx:nginx --from=builder /app/release/app/dist/web /usr/share/nginx/html +COPY ng.conf.template /etc/nginx/templates/default.conf.template +ENV PUBLIC_PATH="/" EXPOSE 9180 CMD ["nginx", "-g", "daemon off;"] diff --git a/README.md b/README.md index ff98b489..e079643e 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,8 @@ docker run --name feishin --port 9180:9180 feishin - **Navidrome** - For the best experience, select "Save password" when creating the server and configure the `SessionTimeout` setting in your Navidrome config to a larger value (e.g. 72h). +3. _Optional_ - If you want to host Feishin on a subpath (not `/`), then pass in the following environment variable: `PUBLIC_PATH=PATH`. For example, to host on `/feishin`, pass in `PUBLIC_PATH=/feishin`. + ## FAQ ### MPV is either not working or is rapidly switching between pause/play states diff --git a/nginx.conf b/ng.conf.template similarity index 88% rename from nginx.conf rename to ng.conf.template index 3b6a38ba..3fed35b8 100644 --- a/nginx.conf +++ b/ng.conf.template @@ -12,9 +12,8 @@ server { gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_comp_level 9; - root /usr/share/nginx/html; - - location / { + location ${PUBLIC_PATH} { + alias /usr/share/nginx/html/; try_files $uri $uri/ /index.html =404; } } \ No newline at end of file