42 lines
1.0 KiB
Plaintext
42 lines
1.0 KiB
Plaintext
server {
|
|
listen 443 ssl;
|
|
server_name <<server_name>>;
|
|
|
|
# SSL certificates
|
|
ssl_certificate <<certificates_path>>/fullchain.pem;
|
|
ssl_certificate_key <<certificates_path>>/privkey.pem;
|
|
|
|
# Default root
|
|
root <<root_path>>;
|
|
|
|
# Autoindex for the main folder
|
|
location / {
|
|
autoindex on;
|
|
autoindex_exact_size off; # optional: show human-readable sizes
|
|
autoindex_localtime on; # optional: show local time
|
|
|
|
# Add custom CSS & JS to autoindex pages
|
|
sub_filter '</head>' '<link rel="stylesheet" href="/autoindex.css">';
|
|
sub_filter '</body>' '<script src="/autoindex.js"></script></body>';
|
|
sub_filter_once on;
|
|
}
|
|
|
|
# Serve the assets from a separate folder
|
|
location = /autoindex.css {
|
|
root <<assets_path>>;
|
|
}
|
|
location = /autoindex.js {
|
|
root <<assets_path>>;
|
|
}
|
|
location = /favicon.ico {
|
|
root <<assets_path>>;
|
|
}
|
|
}
|
|
server {
|
|
listen 80;
|
|
server_name <<server_name>>;
|
|
|
|
return 301 https://<<server_name>>$request_uri;
|
|
}
|
|
|