From 4db65f2c66293049754739a8d28189676510c2c5 Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Sat, 11 Feb 2023 17:29:28 -0500 Subject: [PATCH] [O] Even more simplistic deployment guide --- README.md | 47 +++++------------------------------ docs/examples/arch.nginx.conf | 4 +-- docs/nginx.conf | 4 ++- 3 files changed, 11 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 4836b8a..bd9684a 100644 --- a/README.md +++ b/README.md @@ -32,60 +32,25 @@ yarn build To update, simply do `git pull` and `yarn build` in the same directory. -### 2. Setup File API in Nginx +### 2. Setup File Listing in Nginx This module uses the json file listing api in nginx. If you already have an autoindex file server set up, you can make the following changes. If you're new to nginx, you can check out our [example configs](docs/examples). The following example serves `/data/file-server` on http path `/` -```nginx.conf +```diff server_name your.domain.com; -root /your/file/server/location; +- root /data/file-server; ++ set $dir_path /data/file-server; ++ include "/etc/nginx/MeowIndex/docs/nginx.conf"; -# Serve an index file for your home page (if you want one) -location = / { - index index.html; -} - -include "/etc/nginx/MeowIndex/docs/nginx.conf"; -``` - -### 3. Setup File Listing UI - -You can setup the file listing web UI in two different ways. - -* If you want to deploy on a standalone domain (e.g. `https://files.example.com`), follow Option 1. -* If you want to deploy on a sub-path of an existing domain (e.g. `https://example.com/files`), follow Option 2. - -#### Option 1: Deploying to a standalone domain - -Add the following location block to the same server block as your file api. - -```diff - location / { - fancyindex on; - fancyindex_exact_size off; - } -+ # If no file is found on any path, serve meowindex + location / { -+ try_files $uri /__meowindex__/index.html; -+ } -``` - -#### Option 2: Deploying to a path of an existing domain - -Add the following location block to the same server block as your file api, and replace `/data` with the path you want to deploy to. - -```diff -- location /data { -- fancyindex on; -- fancyindex_exact_size off; -- } - -+ # If no file is found on any path, serve meowindex -+ location /data { -+ try_files $uri /__meowindex__/index.html; ++ try_files $uri $uri/index.html /__meowindex__/index.html; + } ``` \ No newline at end of file diff --git a/docs/examples/arch.nginx.conf b/docs/examples/arch.nginx.conf index 409df13..4b09082 100644 --- a/docs/examples/arch.nginx.conf +++ b/docs/examples/arch.nginx.conf @@ -5,7 +5,7 @@ server listen [::]:443 ssl; server_name arch.hydev.org; - root /data/OS/ArchMirror/RISCV; + set $dirpath /data/OS/ArchMirror/RISCV; # Serve a different file for your home page (if you want one) location = / { @@ -14,7 +14,7 @@ server # If no file is found on any path, serve meowindex location / { - try_files $uri /__meowindex__/index.html; + try_files $uri $uri/index.html /__meowindex__/index.html; } # The MeowIndex web app block diff --git a/docs/nginx.conf b/docs/nginx.conf index be1eb0d..8fed6a7 100644 --- a/docs/nginx.conf +++ b/docs/nginx.conf @@ -1,3 +1,5 @@ +root $dir_path; + # The MeowIndex web app block location /__meowindex__ { alias /etc/nginx/MeowIndex/dist; @@ -15,7 +17,7 @@ location /__meowindex__ { # The api block location /api { - rewrite ^/api(/.*)$ $1 break; + alias $dir_path; index DISABLE_INDEX_HTML_AUTO_MATCHING; autoindex on;