68 lines
2.4 KiB
Plaintext
68 lines
2.4 KiB
Plaintext
server {
|
|
listen 100.69.2.2:8080;
|
|
server_name 100.69.2.2;
|
|
client_max_body_size 5m;
|
|
|
|
location = /mirrors {
|
|
return 302 /;
|
|
}
|
|
location = /mirrors/ {
|
|
return 302 /;
|
|
}
|
|
|
|
location /assets/ {
|
|
root /opt/mirrorouc/current/dist;
|
|
try_files $uri =404;
|
|
add_header X-Content-Type-Options nosniff always;
|
|
}
|
|
|
|
# Fancyindex renders the complete directory on the server. No Go/JSON hop.
|
|
location ~ ^/mirrors/(?<mirror_directory>.+/)$ {
|
|
alias /data/mirrors/$mirror_directory;
|
|
index .mirrorouc-autoindex-only;
|
|
fancyindex on;
|
|
fancyindex_header /_directory/header.html;
|
|
fancyindex_footer /_directory/footer.html;
|
|
fancyindex_show_path off;
|
|
fancyindex_name_length 256;
|
|
fancyindex_exact_size off;
|
|
fancyindex_directories_first on;
|
|
fancyindex_show_dotfiles off;
|
|
fancyindex_localtime off;
|
|
fancyindex_time_format "%Y-%m-%d %H:%M:%S UTC";
|
|
include /opt/mirrorouc/current/dist/fancy-index/labels.conf;
|
|
charset utf-8;
|
|
limit_except GET { deny all; }
|
|
add_header Cache-Control no-cache;
|
|
add_header X-Content-Type-Options nosniff always;
|
|
add_header X-Frame-Options DENY always;
|
|
add_header Referrer-Policy same-origin always;
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'" always;
|
|
}
|
|
|
|
# Only Fancyindex subrequests may read the generated fragments.
|
|
location = /_directory/header.html {
|
|
internal;
|
|
alias /opt/mirrorouc/current/dist/fancy-index/header.html;
|
|
}
|
|
location = /_directory/footer.html {
|
|
internal;
|
|
alias /opt/mirrorouc/current/dist/fancy-index/footer.html;
|
|
}
|
|
|
|
location /mirrors/ {
|
|
alias /data/mirrors/;
|
|
autoindex off;
|
|
add_header X-Content-Type-Options nosniff always;
|
|
add_header Content-Security-Policy "sandbox; default-src 'none'; style-src 'unsafe-inline'; img-src 'self' data:" always;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:8081;
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_read_timeout 35s;
|
|
}
|
|
}
|