我正在使用adblock2privoxy。 adblock2privoxy将生成.filter文件,.action文件到/ etc / privoxy /和.css文件到/ var / www / privoxy。我按照指南设置nginx来隐藏页面元素(通过CSS),但它不起作用。
来自adblock2privoxy指南
server {
listen 80;
#ab2p css domain name (optional)
server_name privoxy.zubr.me;
#root = webDir parameter value
root /var/www/privoxy;
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;
}
}
这是我的nginx.conf
#user html;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
root /var/www/privoxy;
location ~ ^/[^/.]+\..+/ab2p.css$ {
rewrite ^/([^/]*?)\.([^/.]+)(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?/ab2p.css$ /$9/$8/$7/$6/$5/$4/$3/$2/$1/ab2p.css last;
}
location ~ (^.*/+)[^/]+/+ab2p.css {
try_files $uri $1ab2p.css;
}
}
}
这是nginx的系统日志文件
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled)
Active: active (running) since Fri 2014-08-29 09:08:01 ICT; 10s ago
Process: 2806 ExecStart=/usr/bin/nginx -g pid /run/nginx.pid; error_log stderr; (code=exited, status=0/SUCCESS)
Main PID: 2807 (nginx)
CGroup: /system.slice/nginx.service
├─2807 nginx: master process /usr/bin/nginx -g pid /run/nginx.pid; error_log stderr
└─2808 nginx: worker process
Aug 29 09:08:01 manjaro systemd[1]: PID file /run/nginx.pid not readable (yet?) after start.
Aug 29 09:08:01 manjaro systemd[1]: Started A high performance web server and a reverse proxy server.
Aug 29 09:08:06 manjaro nginx[2806]: 2014/08/29 09:08:06 [error] 2808#0: *1 "/var/www/privoxy/exec/obidos/external-search/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET http://www.amazon.com/exec/obidos/external-search/?field-keywords=dfhaskd&mode=blended&tag=mozilla-20&sourceid=Mozilla-search HTTP/1.1", host: "www.amazon.com"
Aug 29 09:08:06 manjaro nginx[2806]: 2014/08/29 09:08:06 [error] 2808#0: *1 open() "/var/www/privoxy/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET http://www.amazon.com/favicon.ico HTTP/1.1", host: "www.amazon.com"
Aug 29 09:08:07 manjaro nginx[2806]: 2014/08/29 09:08:07 [error] 2808#0: *1 open() "/var/www/privoxy/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET http://www.amazon.com/favicon.ico HTTP/1.1", host: "www.amazon.com"
我是新手,我需要你的帮助。