Archive for 'freeBSD'

Squid -k rotate and clear squid cache

Squid -k rotate just a way to ‘clear squid cache’ although it doesn’t clear squid cache (a real cache). But it helps when browsers ’stuck’ with caches (refresh/reload pages doesn’t work)
This description from Squid FAQ
Cache/Log (Squid 1.x) or Swap.State (Squid 2.x)
This file has a rather unfortunate name. It also is often called the swap log. [...]

How to clear Squid cache?

It’s simple, use this command :
# squid -k rotate
This command rotate squid log files but also ‘clear squid cache’, without shutdown and restart squid. This command works in the situation where people have ‘a constant cache’ (refresh/reload a page doesn’t work) in their browser, and ‘clear cache’ without their notice.
What about squid -z?
squid -z is [...]

Accessing computers on a private network by name

I have this problem after OpenDNS setup, i can’t ‘browse’ computer on a private network by name, following a recommendation from OpenDNS, simple tweak in /etc/hosts file.
What is /etc/hosts file?
This is a way for hostnames to map to IP addresses. Operating system will attempt to resolve domain names to IP addresses by first accessing a [...]

Change file owner and group in one ’stroke’

It’s Basic, and i forget this command all the time, use this ‘chown’ in one of servers, i want to (b)log this command :
I am using this command to change a file owner and a group of directory, its subfolders, and its files
chown -R name:group [directory path]
example :
chown -R kate:kate /usr/local/www/directory_name

Setup OpenDNS in Squid

UPDATED
OpenDNS (from its website) : it’s a DNS service, aim to make Internet safer, faster, smarter and more reliable.
This is how to setup OpenDNS in SQUID :
Edit squid.conf and add this :
OPTIONS FOR EXTERNAL SUPPORT PROGRAMS
dns_nameservers 208.67.220.220 208.67.222.222
or
dns_nameservers 208.67.220.220
dns_nameservers 208.67.222.222
Save and run this :
squid -k parse
squid -k reconfigure
but if your squid add nameservers from squid.conf, [...]

Squid : Ports Restrictions

Add this to squid.conf
#Port Lists
acl SSL_ports port 443 563
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 [...]

After reboot, squid -k can not send stop signal again

If reboot and squid -k says it can not send stop signal again, means that squid.pid is missing
Check squid.pid in the system and if missing, here is what i can suggest :
Look into a previous post in this website, then shutdown squid
squid -k shutdown
Create squid.pid (usually squid.pid located in the same directory with log files)
touch [...]

Squid -k problem : can not send stop signal

The squid.pid file is missing or unreadable makes squid -k command don’t work (says it can not send stop signal). We kill Squid manually by finding the process ID with ps.
ps ax | grep squid
If there are more than one Squid process, be sure to kill the one that shows up as (squid).
example
500 [...]