Код: Выделить всё
# uname -irmn
FreeBSD 8.1-STABLE amd64 GENERIC
Код: Выделить всё
# pkg_info
apache-2.2.17_1
squid-3.1.9
pcre-8.10
wget-1.12_2
Код: Выделить всё
# /usr/local/etc/rc.d/apache22 start
Performing sanity check on apache22 configuration:
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Syntax OK
Starting apache22.
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Распаковал архив http://www.tgz в /usr/local/www/apache22/data, т.к в httpd.conf:
Код: Выделить всё
DocumentRoot "/usr/local/www/apache22/data"
В файле squid.conf не было строк cache_effective_user и cache_effective_group, но по умолчанию, если я правильно понимаю, сквид запускается от пользователя squid в FreeBSD, я добавлял эти строки и удалял, но результат был одинаковый:
Код: Выделить всё
# ps -ajx|grep squid
squid 97813 97811 97811 97811 0 S ?? 0:00.21 (squid) (squid)
squid 97814 97813 97811 97811 0 I ?? 0:00.00 (unlinkd) (unlinkd
Код: Выделить всё
SQUID_USER=squid
SQUID_GROUP=squid
Код: Выделить всё
# pw showuser squid
squid:*:100:100::0:0:Squid caching-proxy pseudo user:/var/squid:/bin/sh
Код: Выделить всё
# ./check-redirector
http://127.0.0.1/rejik3/porno.html 127.0.0.1/- - GET
# tail ../redirector.log
2010-11-15 06:45:24 PORNO: 127.0.0.1 - http://sex.ru (urls rule: sex.ru)
Код: Выделить всё
# tail -n1 /usr/local/etc/squid/squid.conf
redirect_program /usr/local/rejik3/redirector /usr/local/rejik3/redirector.conf
Код: Выделить всё
# cat /var/log/squid/cache.log
2010/11/15 07:00:00| Starting Squid Cache version 3.1.9 for amd64-portbld-freebsd8.1...
2010/11/15 07:00:00| Process ID 7792
2010/11/15 07:00:00| With 11095 file descriptors available
2010/11/15 07:00:00| Initializing IP Cache...
2010/11/15 07:00:00| DNS Socket created at [::], FD 12
2010/11/15 07:00:00| DNS Socket created at 0.0.0.0, FD 13
2010/11/15 07:00:00| Adding nameserver 77.37.251.33 from /etc/resolv.conf
2010/11/15 07:00:00| Adding nameserver 77.37.255.30 from /etc/resolv.conf
2010/11/15 07:00:00| helperOpenServers: Starting 5/5 'redirector' processes
2010/11/15 07:00:00| Unlinkd pipe opened on FD 28
2010/11/15 07:00:00| Store logging disabled
2010/11/15 07:00:00| Swap maxSize 0 + 262144 KB, estimated 20164 objects
2010/11/15 07:00:00| Target number of buckets: 1008
2010/11/15 07:00:00| Using 8192 Store buckets
2010/11/15 07:00:00| Max Mem size: 262144 KB
2010/11/15 07:00:00| Max Swap size: 0 KB
2010/11/15 07:00:00| Using Least Load store dir selection
2010/11/15 07:00:00| Set Current Directory to /var/squid/cache
2010/11/15 07:00:00| Loaded Icons.
2010/11/15 07:00:00| Accepting HTTP connections at [::]:3128, FD 29.
2010/11/15 07:00:00| HTCP Disabled.
2010/11/15 07:00:00| Ready to serve requests.
2010/11/15 07:00:01| storeLateRelease: released 0 objects
Код: Выделить всё
# cat /usr/local/rejik3/redirector.err
2010-11-15 07:08:08 [7869] Run make-cache (3.2.8)
2010-11-15 07:08:08 [7869] Make-cache finished
2010-11-15 07:08:08 [7869] Load 658 rules from /usr/local/rejik3/banlists/banners/urls.cache
2010-11-15 07:08:08 [7869] Load 8 pattern from BANNER pcre
2010-11-15 07:08:08 [7869] Load 22283 rules from /usr/local/rejik3/banlists/porno/urls.cache
2010-11-15 07:08:08 [7869] Load 5 pattern from MP3 pcre
2010-11-15 07:08:08 [7869] Load 1 rules from /usr/local/rejik3/banlists/js/urls.cache
2010-11-15 07:08:08 [7869] Redirector start and working (3.2.8)
2010-11-15 07:08:08 [7872] Run make-cache (3.2.8)
2010-11-15 07:08:08 [7872] Make-cache finished
2010-11-15 07:08:08 [7872] Load 658 rules from /usr/local/rejik3/banlists/banners/urls.cache
2010-11-15 07:08:08 [7872] Load 8 pattern from BANNER pcre
2010-11-15 07:08:08 [7872] Load 22283 rules from /usr/local/rejik3/banlists/porno/urls.cache
2010-11-15 07:08:08 [7872] Load 5 pattern from MP3 pcre
2010-11-15 07:08:08 [7872] Load 1 rules from /usr/local/rejik3/banlists/js/urls.cache
2010-11-15 07:08:08 [7872] Redirector start and working (3.2.8)
2010-11-15 07:08:09 [7870] Waiting for make-cache finished
2010-11-15 07:08:09 [7870] Make-cache finished detected, continue
2010-11-15 07:08:09 [7870] Load 658 rules from /usr/local/rejik3/banlists/banners/urls.cache
2010-11-15 07:08:09 [7870] Load 8 pattern from BANNER pcre
2010-11-15 07:08:09 [7870] Load 22283 rules from /usr/local/rejik3/banlists/porno/urls.cache
2010-11-15 07:08:09 [7870] Load 5 pattern from MP3 pcre
2010-11-15 07:08:09 [7870] Load 1 rules from /usr/local/rejik3/banlists/js/urls.cache
2010-11-15 07:08:09 [7870] Redirector start and working (3.2.8)
2010-11-15 07:08:09 [7874] Waiting for make-cache finished
2010-11-15 07:08:09 [7874] Make-cache finished detected, continue
2010-11-15 07:08:09 [7874] Load 658 rules from /usr/local/rejik3/banlists/banners/urls.cache
2010-11-15 07:08:09 [7874] Load 8 pattern from BANNER pcre
2010-11-15 07:08:09 [7874] Load 22283 rules from /usr/local/rejik3/banlists/porno/urls.cache
2010-11-15 07:08:09 [7874] Load 5 pattern from MP3 pcre
2010-11-15 07:08:09 [7874] Load 1 rules from /usr/local/rejik3/banlists/js/urls.cache
2010-11-15 07:08:09 [7874] Redirector start and working (3.2.8)
2010-11-15 07:08:09 [7873] Waiting for make-cache finished
2010-11-15 07:08:09 [7873] Make-cache finished detected, continue
2010-11-15 07:08:09 [7873] Load 658 rules from /usr/local/rejik3/banlists/banners/urls.cache
2010-11-15 07:08:09 [7873] Load 8 pattern from BANNER pcre
2010-11-15 07:08:09 [7873] Load 22283 rules from /usr/local/rejik3/banlists/porno/urls.cache
2010-11-15 07:08:09 [7873] Load 5 pattern from MP3 pcre
2010-11-15 07:08:09 [7873] Load 1 rules from /usr/local/rejik3/banlists/js/urls.cache
2010-11-15 07:08:09 [7873] Redirector start and working (3.2.8)
Вот файл /usr/local/rejik3/redirector.conf:
Код: Выделить всё
error_log /usr/local/rejik3/redirector.err
change_log /usr/local/rejik3/redirector.log
make-cache /usr/local/rejik3/make-cache
#allow_urls /usr/local/rejik3/banlists/allow_urls
<BANNER>
ban_dir /usr/local/rejik3/banlists/banners
url http://127.0.0.1/rejik3/1x1.gif
#log off
<PORNO>
ban_dir /usr/local/rejik3/banlists/porno
url http://127.0.0.1/rejik3/porno.html
<MP3>
ban_dir /usr/local/rejik3/banlists/mp3
url http://127.0.0.1/rejik3/mp3.html
<JS>
ban_dir /usr/local/rejik3/banlists/js
url http://127.0.0.1/rejik3/js.js
#log off
Код: Выделить всё
work_ip 127.0.0.1
Код: Выделить всё
2010/11/15 07:25:04| Preparing for shutdown after 0 requests
2010/11/15 07:25:04| Waiting 30 seconds for active connections to finish
2010/11/15 07:25:04| FD 29 Closing HTTP connection
2010/11/15 07:25:36| Shutting down...
2010/11/15 07:25:36| basic/auth_basic.cc(97) done: Basic authentication Shutdown.
2010/11/15 07:25:36| Closing unlinkd pipe on FD 28
2010/11/15 07:25:36| storeDirWriteCleanLogs: Starting...
2010/11/15 07:25:36| Finished. Wrote 0 entries.
2010/11/15 07:25:36| Took 0.00 seconds ( 0.00 entries/sec).
CPU Usage: 0.018 seconds = 0.009 user + 0.009 sys
Maximum Resident Size: 8516 KB
Page faults with physical i/o: 0
2010/11/15 07:25:36| Open FD UNSTARTED 12 DNS Socket IPv6
2010/11/15 07:25:36| Open FD UNSTARTED 13 DNS Socket IPv4
2010/11/15 07:25:36| Open FD UNSTARTED 14 redirector #1
2010/11/15 07:25:36| Open FD UNSTARTED 16 redirector #2
2010/11/15 07:25:36| Open FD UNSTARTED 18 redirector #3
2010/11/15 07:25:36| Open FD UNSTARTED 20 redirector #4
2010/11/15 07:25:36| Open FD UNSTARTED 22 redirector #5
2010/11/15 07:25:36| Squid Cache (Version 3.1.9): Exiting normally.
Фух, вроде ничего не забыл, где я ошибаюсь, или что забываю настроить?