X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=doc%2FREADME;h=2646d3e5f789f28d826777ef433a28d11e3ddbf4;hp=6e19b1a32e70ba379be1b9604f1cb49b9d3768e9;hb=0beaa7cff04957e17f54267e1130189bdb9868c2;hpb=ae5878d9037c0c23882e3b976d00ea1ee6ae5e8f diff --git a/doc/README b/doc/README index 6e19b1a..2646d3e 100644 --- a/doc/README +++ b/doc/README @@ -5,85 +5,44 @@ any of the images on pr0n.sesse.net etc.) is licensed under the GNU General Public License, version 2. For the full license text, see the COPYING file. Documentation? Forget it; if you can't set it up, use something else. You can -have a typical Apache 2 vhost snippet, though: +have a typical Varnish snippet, though: + +backend pr0n { + .host = "127.0.0.1"; + .port = "5015"; +} + +sub vcl_recv { + if (req.http.host ~ "^pr0n\.sesse\.net(:[0-9]+)?$") { + set req.backend_hint = pr0n; + } +} + +sub vcl_deliver { + if (resp.http.x-varnish-host && resp.http.x-pr0n-purge) { + set resp.http.escaped-regex = regsuball(resp.http.x-pr0n-purge, "\\", "\\\\"); + ban ( "obj.http.x-varnish-host == " + resp.http.x-varnish-host + " && obj.http.x-varnish-url ~ " + resp.http.escaped-regex ); + unset resp.http.escaped-regex; + } + unset resp.http.x-varnish-host; + unset resp.http.x-varnish-url; + unset resp.http.x-pr0n-purge; +} + +sub vcl_backend_response { + if (bereq.http.host ~ "^pr0n\.sesse\.net(:[0-9]+)?$") { + set beresp.ttl = 1w; + set beresp.http.x-varnish-host = bereq.http.host; + set beresp.http.x-varnish-url = bereq.url; + if (beresp.http.content-type ~ "^(text/html|text/plain|text/xml|text/css|application/x-javascript|application/javascript)") { + set beresp.do_gzip = true; + } + } else { + unset beresp.http.x-varnish-host; + } +} + +To redeploy after changes: + + sudo service pr0n reload && sudo varnishadm 'ban obj.http.x-varnish-host ~ "."' - - ServerAdmin sgunderson@bigfoot.com - DocumentRoot /srv/pr0n.sesse.net - ServerName pr0n.sesse.net - ServerAlias pr0n.sesse.net bilder.knatten.com pannekake.samfundet.no - - LogLevel info - ErrorLog /var/log/apache2/error-pr0n.sesse.net.log - CustomLog /var/log/apache2/access-pr0n.sesse.net.log combined - - ServerSignature On - PerlSwitches -wT - - # Keep this on during debugging -# PerlModule Apache2::Reload -# PerlInitHandler Apache2::Reload -# PerlSetVar ReloadAll Off -# PerlSetVar ReloadModules "Sesse::pr0n::*" -# PerlSetVar ReloadConstantRedefineWarnings Off - - # Share the loadavg module - PerlModule Sesse::pr0n::Overload - - PerlSetVar ImageBase /srv/pr0n.sesse.net/ - PerlSetVar TemplateBase /srv/pr0n.sesse.net/templates - PerlSetVar OverloadMode Off - PerlSetVar OverloadEnableThreshold 100.0 - PerlSetVar OverloadDisableThreshold 5.0 - - # All URLs are handled by the central pr0n module - - SetHandler modperl - PerlResponseHandler Sesse::pr0n::pr0n - - - - - ServerAdmin sgunderson@bigfoot.com - DocumentRoot /srv/pr0n.sesse.net - ServerName pr0n.sesse.net - ServerAlias pr0n.sesse.net bilder.knatten.com pannekake.samfundet.no - - LogLevel info - ErrorLog /var/log/apache2/error-pr0n.sesse.net.log - CustomLog /var/log/apache2/access-pr0n.sesse.net.log combined - - ServerSignature On - PerlSwitches -wT - - SSLEngine on - SSLCertificateFile ssl/pr0n.sesse.net.crt - SSLCertificateKeyFile ssl/pr0n.sesse.net.key - - # Keep this on during debugging -# PerlModule Apache2::Reload -# PerlInitHandler Apache2::Reload -# PerlSetVar ReloadAll Off -# PerlSetVar ReloadModules "Sesse::pr0n::*" -# PerlSetVar ReloadConstantRedefineWarnings Off - - # Share the loadavg module - PerlModule Sesse::pr0n::Overload - - PerlSetVar ImageBase /srv/pr0n.sesse.net/ - PerlSetVar TemplateBase /srv/pr0n.sesse.net/templates - PerlSetVar OverloadMode Off - PerlSetVar OverloadEnableThreshold 100.0 - PerlSetVar OverloadDisableThreshold 5.0 - - # All URLs are handled by the central pr0n module - - SetHandler modperl - PerlResponseHandler Sesse::pr0n::pr0n - - - -Also, mod_deflate is recommended; just install it and use the default -configuration, and it will work transparently. (You might want to add -text/css and application/x-javascript to the list of compressed -formats, but it's not really _that_ important.)