Cache no Squid3 [RESOLVIDO]

1. Cache no Squid3 [RESOLVIDO]

Junior Guerreiro
Tchula

(usa Debian)

Enviado em 28/04/2016 - 09:38h

Bom dia...

Estou com um problema no squid3, toda vez que configuro o cache o proxy não funciona, ainda não consegui por o cache p´ra funcionar no squid3, por favor alguma orientação, abaixo esta minha configuração do squid3

#########INICIO DA CONFIGURAÇÃO################

emulate_httpd_log on

http_port 3128
visible_hostname debian

acl all src 0.0.0.0/0.0.0.0
#acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.0

#########INICIO DA CONFIGURAÇÃO DO CACHE##########################

cache_mem 128 MB

maximum_object_size_in_memory 64 KB
maximum_object_size 512 MB
minimum_object_size 0 KB

cache_swap_low 90
cache_swap_high 95

cache_dir ufs /var/cache/squid3 2048 16 256
cache_access_log /var/log/squid3/access.log

refresh_pattern ^ftp: 15 20% 2280
refresh_pattern ^gopher: 15 0% 2280
refresh_pattern . 15 20% 2280



  


2. Re: Cache no Squid3 [RESOLVIDO]

Bruno Thomaz
SarusKant

(usa CentOS)

Enviado em 28/04/2016 - 12:47h

Opa,
Falta bastante coisa nesse seu squid.conf.
Poste o log de erro que ocorre.

No aguardo.
--
Bruno Thomaz


3. Squid3

Junior Guerreiro
Tchula

(usa Debian)

Enviado em 28/04/2016 - 13:32h

Boa tarde..

Segue toda a configuração do meu squid3, esta comentado a parte do cahe porque se eu descomentar o proxy para de acessar a internet.

#########INICIO DA CONFIGURAÇÃO################

emulate_httpd_log on

http_port 3128
visible_hostname debian

acl all src 0.0.0.0/0.0.0.0
#acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.0

#########INICIO DA CONFIGURAÇÃO DO CACHE##########################

#cache_men 128 MB
#maximum_object_size_in_memory 64 KB
#maximum_object_size 512 MB
#minimum_object_size 0 KB

#cache_swap_low 90
#cache_swap_high 95

#cache_dir ufs /var/spool/squid3 2048 16 256
#cacha_access_log /var/log/squid3/access.log

#refresh_pattern ^ftp: 15 20% 2280
#refresh_pattern ^gopher: 15 0% 2280
#refresh_pattern . 15 20% 2280

#########FIM DA CONFIGURAÇÃO DO CACHE#############################

acl SSL_ports port 443 563
acl Safe_ports port 80 # http
acl Safe_ports port 8080 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 563 # https, snews
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 901 # swat
acl Safe_ports port 63259 # skype
acl Safe_ports port 1025-65535 # portas altas

acl almoco time 12:00-14:30
http_access allow almoco

##########INICIO DA AUTENTICAÇÃO POR USUÁRIO##################

auth_param basic realm Servidor_Proxy (Digite Usuario e Senha)
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid3/squid_passwd
acl autenticados proxy_auth REQUIRED

#######FIM DA CONFIGURAÇÃO DE AUTENTICAÇÃO####################


########INICIO DE BLOQUEIO DE PAGINAS##########################


acl liberados proxy_auth "/etc/squid3/liberados"
http_access allow liberados

acl sitesliberados url_regex -i "/etc/squid3/sitesliberados
http_access allow sitesliberados


acl intranet url_regex -i "/etc/squid3/intranet"
acl tom proxy_auth tom
acl derivan proxy_auth derivan
acl adriano proxy_auth adriano
http_access allow intranet tom
http_access allow intranet derivan
http_access allow intranet adriano
http_access deny tom all
http_access deny derivan all
http_access deny adriano all

acl listadebloqueios url_regex -i "/etc/squid3/listadebloqueios"
http_access deny listadebloqueios

acl palavras_negadas url_regex -i "/etc/squid3/palavras_negadas"
http_access deny palavras_negadas

reply_body_max_size 10 MB

http_access allow autenticados


#########FIM DA CONFIGURAÇÃO DE AUTENTICAÇÃO####################


acl purge method PURGE
acl CONNECT method CONNECT

http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports

acl redelocal src 192.168.0.0/24
http_access allow localhost
http_access allow redelocal

http_access deny all



4. Re: Cache no Squid3 [RESOLVIDO]

Bruno Thomaz
SarusKant

(usa CentOS)

Enviado em 28/04/2016 - 14:23h

Perfeito, cara agora, poste o conteudo dos arquivos de log, tanto o access.log, quanto o cache.log
Para podermos ver qual é o erro que ele esta acusando.

Att
--
Bruno Thomaz


5. Cahe

Junior Guerreiro
Tchula

(usa Debian)

Enviado em 28/04/2016 - 14:49h

Bruno boa tarde e obrigado pela sua atenção.

Vc está me pedindo todo o arquivo de log do squid3, e muito grande vc quer que eu poste aqui o arquivo todo?


6. Re: Cache no Squid3 [RESOLVIDO]

Bruno Thomaz
SarusKant

(usa CentOS)

Enviado em 28/04/2016 - 15:08h

Não Não somente aonde acusa o erro.
Quando você habilita a regra o proxy não roda ou simplesmente roda e não trafega?
De acordo com a circunstancia, teremos um log do erro especifico, quero que poste este.

Att
--
Bruno Thomaz


7. Cache no Squid3

Junior Guerreiro
Tchula

(usa Debian)

Enviado em 28/04/2016 - 15:23h

Bruno, nem roda, tanto que dei uma olhada no log e não tenho nenhuma mensagem de erro, simplesmente quando configuro o cache parece que o proxy para de funcionar?


8. Re: Cache no Squid3 [RESOLVIDO]

Bruno Thomaz
SarusKant

(usa CentOS)

Enviado em 28/04/2016 - 15:33h

Cara, o squid tem 3 arquivos de log.
Access log -> navegação e requisições
Store log -> para o cache (Deve habilitar)
Cache log -> logs do squid (error,warnings,entreoutros) # Este é o que você deve ver.

Normalmente ele se localiza na pasta: /var/log/squid/

No Aguardo.
--
Bruno Thomaz


9. Cache no Squid3

Junior Guerreiro
Tchula

(usa Debian)

Enviado em 28/04/2016 - 15:55h

Bruno, parece que quando eu ativo o cache o squid3 para de funcionar porque nem log no cache ele gera, não gera nada.

:43:26 kid1| Open FD READ/WRITE 150 Reading next request
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 151 Reading next request
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 152 bay403-m.hotmail.com:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 153 connect.facebook.net:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 155 Reading next request
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 156 blu406-m.hotmail.com:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 157 zeromov.com:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 158 s0.2mdn.net:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 160 Idle server: 200.147.67.185:80/imp.ads.imguol.com
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 161 Idle server: 216.58.202.2:80/www.googletagservices.com
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 163 Idle server: 104.73.85.169:80/ads.rubiconproject.com
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 164 Idle server: 52.5.110.164:80/tt-10162-1.seg.t.tailtarget.com
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 165 Reading next request
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 166 Reading next request
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 169 Idle server: 216.58.202.2:80/pagead2.googlesyndication.com
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 170 media.melia.com:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 171 secure-ds.serving-sys.com:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 172 Idle server: 216.58.202.2:80/pagead2.googlesyndication.com
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 176 comet.yahoo.com:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 179 Idle server: 200.123.199.32:80/b.scorecardresearch.com
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 183 www.gstatic.com:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 185 Reading next request
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 188 secure-ds.serving-sys.com:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 192 Idle server: 200.123.199.27:80/ds.serving-sys.com
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 193 Reading next request
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 194 clients4.google.com:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 195 pubads.g.doubleclick.net:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 196 ieonline.microsoft.com:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 198 Idle server: 54.230.81.109:80/wfpscripts.webspectator.com
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 200 csi.gstatic.com:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 201 Idle client: Waiting for next request
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 204 Idle client: Waiting for next request
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 211 Reading next request
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 212 Idle server: 8.43.72.22:80/optimized-by.rubiconproject.com
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 165 Reading next request
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 166 Reading next request
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 169 Idle server: 216.58.202.2:80/pagead2.googlesyndication.com
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 255 media.melia.com:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 264 tpc.googlesyndication.com:443
2016/04/28 15:43:26 kid1| Open FD READ/WRITE 265 cm.g.doubleclick.net:443
2016/04/28 15:43:26 kid1| Squid Cache (Version 3.4.8): Exiting normally.
2016/04/28 15:53:38 kid1| Current Directory is /
2016/04/28 15:53:38 kid1| Starting Squid Cache version 3.4.8 for i586-pc-linux-gnu...
2016/04/28 15:53:38 kid1| Process ID 9982
2016/04/28 15:53:38 kid1| Process Roles: worker
2016/04/28 15:53:38 kid1| With 65535 file descriptors available
2016/04/28 15:53:38 kid1| Initializing IP Cache...
2016/04/28 15:53:38 kid1| DNS Socket created at [::], FD 7
2016/04/28 15:53:38 kid1| DNS Socket created at 0.0.0.0, FD 8
2016/04/28 15:53:38 kid1| Adding nameserver 192.168.0.250 from /etc/resolv.conf
2016/04/28 15:53:38 kid1| Adding nameserver 192.168.0.251 from /etc/resolv.conf
2016/04/28 15:53:38 kid1| helperOpenServers: Starting 0/20 'basic_ncsa_auth' processes
2016/04/28 15:53:38 kid1| helperOpenServers: No 'basic_ncsa_auth' processes needed.
2016/04/28 15:53:38 kid1| Logfile: opening log daemon:/var/log/squid3/access.log
2016/04/28 15:53:38 kid1| Logfile Daemon: opening log /var/log/squid3/access.log
2016/04/28 15:53:38 kid1| Local cache digest enabled; rebuild/rewrite every 3600/3600 sec
2016/04/28 15:53:38 kid1| Store logging disabled
2016/04/28 15:53:38 kid1| Swap maxSize 0 + 262144 KB, estimated 20164 objects
2016/04/28 15:53:38 kid1| Target number of buckets: 1008
2016/04/28 15:53:38 kid1| Using 8192 Store buckets
2016/04/28 15:53:38 kid1| Max Mem size: 262144 KB
2016/04/28 15:53:38 kid1| Max Swap size: 0 KB
2016/04/28 15:53:38 kid1| Using Least Load store dir selection
2016/04/28 15:53:38 kid1| Current Directory is /
2016/04/28 15:53:38 kid1| Finished loading MIME types and icons.
2016/04/28 15:53:38 kid1| HTCP Disabled.
2016/04/28 15:53:38 kid1| Pinger socket opened on FD 13
2016/04/28 15:53:38 kid1| Squid plugin modules loaded: 0
2016/04/28 15:53:38 kid1| Adaptation support is off.
2016/04/28 15:53:38 kid1| Accepting HTTP Socket connections at local=[::]:3128 remote=[::] FD 11 flags=9
2016/04/28 15:53:38| pinger: Initialising ICMP pinger ...
2016/04/28 15:53:38| pinger: ICMP socket opened.
2016/04/28 15:53:38| pinger: ICMPv6 socket opened
2016/04/28 15:53:38 kid1| Starting new basicauthenticator helpers...
2016/04/28 15:53:38 kid1| helperOpenServers: Starting 1/20 'basic_ncsa_auth' processes



10. Re: Cache no Squid3 [RESOLVIDO]

Bruno Thomaz
SarusKant

(usa CentOS)

Enviado em 28/04/2016 - 16:09h

Bom, vamos tentar isso.

Pare o serviço do squid.

Troque suas refresh_patterns
por estas.

refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320


Modifique a linha de cache

cache_dir ufs /var/spool/squid 2048 16 256


Acrescente esta linha.
coredump_dir /var/spool/squid 


Apague o cache atual.

rm -rf /var/spool/squid3


Re-crie o cache.

mkdir -p /var/spool/squid
chown squid.squid /var/spool/squid
squid -z


Feito isso, inicie o serviço do squid, ai vejamos, se vai funcionar.

Poste o log.

Att

--
Bruno Thomaz


11. Cache no Squid3

Junior Guerreiro
Tchula

(usa Debian)

Enviado em 28/04/2016 - 16:27h

Bruno este comando não esta rodando esta dando erro de usuario não existe, sou muito leigo no linux ainda...

chown: usuário inválido: “squid.squid”
squid.squid /var/spool/squid


12. Cache no Squid3

Junior Guerreiro
Tchula

(usa Debian)

Enviado em 28/04/2016 - 16:32h

Será que fiz certo?

#cache_men 128 MB
#maximum_object_size_in_memory 64 KB
#maximum_object_size 512 MB
#minimum_object_size 0 KB

#cache_swap_low 90
#cache_swap_high 95


#cache_dir ufs /var/spool/squid3 2048 16 256
#cacha_access_log /var/log/squid3/access.log
#coredump_dir /var/spool/squid3

#refresh_pattern ^ftp: 1440 20% 10080
#refresh_pattern ^gopher: 1440 0% 1440
#refresh_pattern -i (/cgi-bin/|\?)0 0% 0
#refresh_pattern . 0 20% 4320




01 02 03



Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts