mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
1.9 KiB
84 lines
1.9 KiB
if ($request_uri ~ ^/(?!captcha|randombanner|forms|logout|socket\.io)) {
|
|
rewrite ^([^.\?]*[^/])$ $1/ redirect;
|
|
rewrite ^(.+)/$ $1/index.html redirect;
|
|
}
|
|
|
|
location = /robots.txt {
|
|
access_log off;
|
|
add_header Content-Type text/plain;
|
|
return 200 "User-agent: *\nDisallow:\n";
|
|
}
|
|
|
|
location = /favicon.ico {
|
|
access_log off;
|
|
expires max;
|
|
root /path/to/jschan/static/file;
|
|
try_files $uri =404;
|
|
}
|
|
|
|
location = / {
|
|
return 302 $scheme://$host/index.html;
|
|
}
|
|
|
|
location /captcha {
|
|
root /path/to/jschan/static/captcha;
|
|
if ($cookie_captchaid) {
|
|
return 302 $scheme://$host/captcha/$cookie_captchaid.jpg;
|
|
}
|
|
try_files /$cookie_captchaid.jpg @backend;
|
|
}
|
|
|
|
# authed, no cache pages
|
|
location ~* ^/((\w+/manage/.*|globalmanage/(reports|bans|recent|boards|globallogs|news|editnews/.*|accounts|editaccount/.*|roles|editrole/.*|settings))|sessions|mypermissions|account|create|twofactor|csrf)\.(html|json)$ {
|
|
expires 0;
|
|
try_files /dev/null @backend-private;
|
|
}
|
|
|
|
# public html
|
|
location ~* \.html$ {
|
|
expires 0;
|
|
root /path/to/jschan/static/html;
|
|
try_files $uri @backend;
|
|
}
|
|
|
|
# public json
|
|
location ~* \.json$ {
|
|
expires 0;
|
|
root /path/to/jschan/static/json;
|
|
try_files $uri @backend;
|
|
}
|
|
|
|
# CSS
|
|
location ~* \.css$ {
|
|
access_log off;
|
|
expires 1w;
|
|
root /path/to/jschan/static;
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# Scripts
|
|
location ~* \.js$ {
|
|
expires 1w;
|
|
access_log off;
|
|
root /path/to/jschan/static;
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# Files (image, video, audio, other)
|
|
location ~* \.(png|jpg|jpeg|webmanifest|xml|ico|apng|bmp|webp|pjpeg|jfif|gif|mp4|webm|mov|mkv|svg|flac|mp3|ogg|wav|opus)$ {
|
|
access_log off;
|
|
expires max;
|
|
root /path/to/jschan/static;
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# inline in browser so even HTML filetypes can be offered and will present a "save" dialog box
|
|
location ~* \.(txt|pdf|tgkr)$ {
|
|
access_log off;
|
|
expires max;
|
|
add_header Cache-Control "public";
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Content-Disposition "attachment";
|
|
root /path/to/jschan/static;
|
|
try_files $uri =404;
|
|
}
|
|
|