From e588ff17c7574c0aaddf2746a169f2f0efcc3ad2 Mon Sep 17 00:00:00 2001 From: rhld16 Date: Sat, 8 Nov 2025 17:41:59 +0000 Subject: [PATCH] added a reasonable nginx config as example in the selfhosted page --- .github/assets/nginx.conf | 29 +++++++++++++++++++++++++++++ docs/other/selfhosting.md | 6 +++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 .github/assets/nginx.conf diff --git a/.github/assets/nginx.conf b/.github/assets/nginx.conf new file mode 100644 index 000000000..f9d8e412d --- /dev/null +++ b/.github/assets/nginx.conf @@ -0,0 +1,29 @@ +server { + listen 80; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + add_header X-Frame-Options "DENY"; + add_header X-Content-Type-Options "nosniff"; + add_header X-XSS-Protection "1; mode=block"; + add_header Referrer-Policy "no-referrer-when-downgrade"; + } + + location ~* \.(?:css|js|jpg|jpeg|gif|png|svg|ico|woff2?)$ { + expires 30d; + add_header Cache-Control "public"; + } + + error_log /var/log/nginx/error.log warn; + access_log /var/log/nginx/access.log; +} + +gzip on; +gzip_types text/plain text/css application/javascript application/json image/svg+xml; +gzip_min_length 1000; +gzip_proxied any; +gzip_vary on; \ No newline at end of file diff --git a/docs/other/selfhosting.md b/docs/other/selfhosting.md index 6037830a3..070aacc15 100644 --- a/docs/other/selfhosting.md +++ b/docs/other/selfhosting.md @@ -130,4 +130,8 @@ There are a few variables you can change if you wish to disable them: # PowerShell rm -r -fo docs/.vitepress/cache - ``` \ No newline at end of file + ``` + +### Reverse Proxy + +You should be able to use any reverse proxy with this vitepress website, but find a reasonable config for an nginx server [in the repo here](https://github.com/fmhy/edit/blob/main/.github/assets/nginx.conf) \ No newline at end of file