source: adblock2privoxy/README @ 899fa03

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

fine tuning before release

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