]> git.sesse.net Git - pr0n/blob - doc/README
Bump version number.
[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(:[0-9]+)?$") {
17         set req.backend_hint = pr0n;
18         if (req.method == "PUT") {
19             return (pipe);
20         }
21     }
22 }
23
24 sub vcl_deliver {
25     if (resp.http.x-varnish-host && resp.http.x-pr0n-purge) {
26         set resp.http.escaped-regex = regsuball(resp.http.x-pr0n-purge, "\\", "\\\\");
27         ban ( "obj.http.x-varnish-host == " + resp.http.x-varnish-host + " && obj.http.x-varnish-url ~ " + resp.http.escaped-regex );
28         unset resp.http.escaped-regex;
29     }
30     unset resp.http.x-varnish-host;
31     unset resp.http.x-varnish-url;
32     unset resp.http.x-pr0n-purge;
33 }
34
35 sub vcl_backend_response {
36     if (bereq.http.host ~ "^pr0n\.sesse\.net(:[0-9]+)?$") {
37         set beresp.ttl = 1w;
38         set beresp.http.x-varnish-host = bereq.http.host;
39         set beresp.http.x-varnish-url = bereq.url;
40         if (beresp.http.content-type ~ "^(text/html|text/plain|text/xml|text/css|application/x-javascript|application/javascript)") {
41             set beresp.do_gzip = true;
42         }
43     } else {
44         unset beresp.http.x-varnish-host;
45     }
46 }
47
48 To redeploy after changes:
49
50   sudo service pr0n reload && sudo varnishadm 'ban obj.http.x-varnish-host ~ "."'
51