added a reasonable nginx config as example in the selfhosted page (#4280)

This commit is contained in:
rhld16 2025-11-09 01:55:55 +00:00 committed by GitHub
parent b8a66c7493
commit 365dbd6f4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 1 deletions

29
.github/assets/nginx.conf vendored Normal file
View file

@ -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;

View file

@ -130,4 +130,8 @@ There are a few variables you can change if you wish to disable them:
# PowerShell # PowerShell
rm -r -fo docs/.vitepress/cache rm -r -fo docs/.vitepress/cache
``` ```
### 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)