Skip to content

Instantly share code, notes, and snippets.

@simon987
Last active February 22, 2020 03:56
Show Gist options
  • Save simon987/40f8d81878c45e43a6b91db327d8f4c0 to your computer and use it in GitHub Desktop.
Save simon987/40f8d81878c45e43a6b91db327d8f4c0 to your computer and use it in GitHub Desktop.
libgen_mirror
proxy_cache_path /files/.cache/
levels=1:2
keys_zone=lg_cache:1m
max_size=90g inactive=168h use_temp_path=off;
server {
listen 80;
# Workaround for symlinks
location /libgen.rar {
add_header Content-Type "text/plain;charset=UTF-8";
return 200 'Please download libgen_yyyy-mm-dd.rar instead, thank you. \nПожалуйста, скачайте libgen_yyyy-mm-dd.rar\n';
}
location /scimag.sql.gz {
add_header Content-Type "text/plain;charset=UTF-8";
return 200 'Please download scimag_yyyy-mm-dd.sql.gz instead, thank you. \nПожалуйста, скачайте scimag_yyyy-mm-dd.sql.gz\n';
}
location /fiction.rar {
add_header Content-Type "text/plain;charset=UTF-8";
return 200 'Please download fiction_yyyy-mm-dd.rar instead, thank you. \nПожалуйста, скачайте fiction_yyyy-mm-dd.rar.\n';
}
location /libgen_compact.rar {
add_header Content-Type "text/plain;charset=UTF-8";
return 200 'Please download libgen_compact_yyyy-mm-dd.rar instead, thank you. \nПожалуйста, скачайте libgen_compact_yyyy-mm-dd.rar.\n';
}
# Don't cache file listing
location = / {
proxy_pass http://gen.lib.rus.ec/dbdumps/;
}
location / {
proxy_cache lg_cache;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
proxy_cache_valid any 168h;
proxy_cache_revalidate on;
add_header X-Cache-Status $upstream_cache_status;
proxy_pass http://gen.lib.rus.ec/dbdumps/;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment