Skip to content

Instantly share code, notes, and snippets.

Created December 23, 2012 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/4366284 to your computer and use it in GitHub Desktop.
Save anonymous/4366284 to your computer and use it in GitHub Desktop.
An nginx config stanza that implements a fully working TPB proxy, as talked about here: https://torrentfreak.com/pirate-bay-censorship-backfires-as-new-proxies-bloom-121222/. Also requires wildcard DNS for "*.subdomain.example.com" and for "subdomain.example.com" to point towards the server hosting this proxy. Have fun ...
server {
listen [::]:80;
listen 80;
server_name "~^(?<thishost>[^.]+.)?(subdomain.example.com)$";
access_log off;
location / {
resolver 8.8.8.8; # or whatever your server can use
sub_filter_once off;
sub_filter 'thepiratebay.se' 'subdomain.example.com';
proxy_pass http://${thishost}thepiratebay.se;
proxy_set_header Accept-Encoding ""; # otherwise content sub fails
gzip off; # otherwise content sub fails
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment