source: adblock2privoxy/README @ 80a88b2

Last change on this file since 80a88b2 was 80a88b2, checked in by zubr <a@…>, 6 years ago

fixed cabal and readme

  • Property mode set to 100644
File size: 3.5 KB
Line 
1Adblock2Privoxy
2Convert adblock config files to privoxy format
3
4Introduction
5
6AdBlock Plus browser plugin has great block list files provided by big community, but it is client software and cannot work on a server as proxy.
7
8Privoxy proxy has good potential to block ads at server side, but it experiences acute shortage of updated block lists.
9
10This software converts adblock lists to privoxy config files format.
11
12Almost all adblock features are supported including
13
14- block/unblock requests (on privoxy)
15    all syntax features are supported except for regex templates matching host name
16- hide/unhide page elements (via CSS)
17    all syntax features are supported
18- all block request options except for outdated ones:
19    Supported: script, image, stylesheet, object, xmlhttprequest, object-subrequest, subdocument,document, elemhide, other, popup, third-party, domain=..., match-case, donottrack
20    Unsupported: collapse, background, xbl, ping and dtd
21   
22Tested with privoxy version 3.0.21. Element blocking feature requires a webserver to serve CSS files. See Nginx and Apache config examples provided.
23
24Usage
25
26adblock2privoxy [OPTION...] adblockFiles...
27  -V       --version          show version number
28  -p PATH  --privoxyDir=PATH  privoxy config output path (required)
29  -w PATH  --webDir=PATH      css files output path (optional, privoxyDir is used by default)
30Example: adblock2privoxy -p /etc/privoxy -w /var/www/privoxy easylist.txt advblock.txt my_custom.txt
31
32How to apply results
33
341) Install privoxy. Optionally setup it as transparent proxy
35
362) Change privoxy config file: Add following lines
37
38actionsfile ab2p.system.action
39actionsfile ab2p.action
40filterfile ab2p.system.filter
41filterfile ab2p.filter
423) Install nginx or apache webserver
43
44Nginx config example:
45
46server {
47        listen 80;
48        #ab2p css domain name (optional)
49        server_name privoxy.zubr.me;
50
51        #root = webDir parameter value
52        root /var/www/privoxy;
53
54        location ~ ^/[^/.]+\..+/ab2p.css$ {
55                # first reverse domain names order
56                        rewrite ^/([^/]*?)\.([^/.]+)(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?/ab2p.css$ /$9/$8/$7/$6/$5/$4/$3/$2/$1/ab2p.css last;
57        }
58
59        location ~ (^.*/+)[^/]+/+ab2p.css {
60                # then try to get CSS for current domain
61                # if it is unavailable - get CSS for parent domain
62                try_files $uri $1ab2p.css;
63        }
64}
65Apache config example:
66
67<VirtualHost *:80>
68        #ab2p css domain name (optional)
69        ServerName www.example.com
70
71        #root = webDir parameter value
72        DocumentRoot /var/www/privoxy
73
74
75        RewriteEngine on
76
77        # first reverse domain names order
78        RewriteRule ^/([^/]*?)\.([^/.]+)(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?/ab2p.css$ /$9/$8/$7/$6/$5/$4/$3/$2/$1/ab2p.css [N]
79
80        # then try to get CSS for current domain
81        # if it is unavailable - get CSS for parent domain
82        RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
83        RewriteRule (^.*/+)[^/]+/+ab2p.css$ $1ab2p.css [N]
84</VirtualHost>
854) Download adblock config files. Some download locations
86EasyList: ​https://easylist.adblockplus.org/en/
87Russian AD list: ​https://code.google.com/p/ruadlist/
88
895) Run adblock2privoxy providing privoxy dir, web dir and adblock input files
90
916) Restart privoxy and apache to load updated configs
92
93Clone repository from ​http://projects.zubr.me/adblock2privoxy.git
Note: See TracBrowser for help on using the repository browser.