Skip to content

Instantly share code, notes, and snippets.

Created December 23, 2012 21:35

Revisions

  1. @invalid-email-address Anonymous created this gist Dec 23, 2012.
    15 changes: 15 additions & 0 deletions gistfile1.nginxconf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    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
    }
    }