forked from essandess/adblock2privoxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
52 lines (41 loc) · 1.53 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
worker_processes auto;
events {
worker_connections 64;
}
# this must be consistent with daemondo's --pidfile specification
pid /opt/local/var/run/nginx/nginx-adblock2privoxy.pid;
# error_log /opt/local/var/log/nginx/error_adblock2privoxy.log warn;
error_log off;
http {
# access_log /opt/local/var/log/nginx/access_adblock2privoxy.log;
access_log off;
# avoid error 413 Request Entity Too Large
# client_max_body_size 64M;
keepalive_timeout 65;
server {
listen 127.0.0.1:8119;
#ab2p css domain name (optional, should be equal to --domainCSS parameter)
server_name localhost;
#root = --webDir parameter value
root /usr/local/etc/adblock2privoxy/css;
# Ensure that http://localhost:8119/ is a legitimate (200 return code)
# default page; use as iOS proxy.pac blackhole
# Test with curl -I --proxy http://127.0.0.1:8119 http://www.foo.com/bar?q=snafoo
location / {
rewrite ^ /default.html break;
}
location ~ ^/+(ab2p(?:\.common)?\.css) {
# ab2p.css in top-level directory
try_files $uri $1;
}
location ~ ^/[^/.]+\..+/ab2p\.css$ {
# first reverse domain names order
rewrite ^/([^/]*?)\.([^/.]+)(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?/ab2p.css$ /$9/$8/$7/$6/$5/$4/$3/$2/$1/ab2p.css last;
}
location ~ (^.*/+)[^/]+/+ab2p\.css {
# then try to get CSS for current domain
# if it is unavailable - get CSS for parent domain
try_files $uri $1ab2p.css;
}
}
}