]> git.sesse.net Git - pr0n/blob - doc/README
Some opacity tweaks for the immersive experience.
[pr0n] / doc / README
1 pr0n is copyright Steinar H. Gunderson <sgunderson@bigfoot.com>. Everything
2 (that includes the Perl code, the configuration snippets, the database schema,
3 the CSS, the templates, any HTML or JavaScript and any documentation, but _not_
4 any of the images on pr0n.sesse.net etc.) is licensed under the GNU General
5 Public License, version 2. For the full license text, see the COPYING file.
6
7 Documentation? Forget it; if you can't set it up, use something else. You can
8 have a typical Varnish snippet, though:
9
10 backend pr0n {
11     .host = "127.0.0.1";
12     .port = "5015";
13 }
14
15 sub vcl_recv {
16     if (req.http.host == "pr0n.sesse.net") {
17         set req.backend_hint = pr0n;
18     }
19 }
20
21 sub vcl_deliver {
22     if (resp.http.x-varnish-host && resp.http.x-pr0n-purge) {
23         set resp.http.escaped-regex = regsuball(resp.http.x-pr0n-purge, "\\", "\\\\");
24         ban ( "obj.http.x-varnish-host == " + resp.http.x-varnish-host + " && obj.http.x-varnish-url ~ " + resp.http.escaped-regex );
25         unset resp.http.escaped-regex;
26     }
27     unset resp.http.x-varnish-host;
28     unset resp.http.x-varnish-url;
29     unset resp.http.x-pr0n-purge;
30 }
31
32 sub vcl_backend_response {
33     if (bereq.http.host == "pr0n.sesse.net") {
34         set beresp.ttl = 1w;
35         set beresp.http.x-varnish-host = bereq.http.host;
36         set beresp.http.x-varnish-url = bereq.url;
37         if (beresp.http.content-type ~ "^(text/html|text/plain|text/xml|text/css|application/x-javascript|application/javascript)") {
38             set beresp.do_gzip = true;
39         }
40     } else {
41         unset beresp.http.x-varnish-host;
42     }
43 }
44
45 To redeploy after changes:
46
47   sudo service pr0n reload && sudo varnishadm 'ban obj.http.x-varnish-host ~ "."'
48