Proxy server: Squid

Configuration

by ross at 04:06:23 on September 19, 2014
  • Anonymous proxy-server on 192.168.10.1
  • Use larger cache
  • Move squid directory (cache and logs) to /home/squid

Install:

# cd /usr/ports/www/squid
# make install clean
# rehash

Options for squid:

  • Check SQUID_LARGEFILE

Add to /etc/rc.conf:

squid_enable="YES"

Move squid directory to /home/squid:

# mkdir /home/squid
# cd /home/squid
# mkdir cache logs
# chown squid:squid *
# chmod 750 *

/usr/local/etc/squid/squid.conf


This is a 2 gig cache, adjust as you see fit.

# cd /usr/local/etc/squid
# cp squid.conf.default squid.conf
--- squid.conf.sample   2014-09-19 06:51:23.662676000 +0300
+++ squid.conf  2014-09-19 07:00:42.548634249 +0300
@@ -40,7 +40,7 @@
 # We strongly recommend the following be uncommented to protect innocent
 # web applications running on the proxy server who think the only
 # one who can access services on "localhost" is a local user
-#http_access deny to_localhost
+http_access deny to_localhost
 
 #
 # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
@@ -62,7 +62,7 @@
 #cache_dir ufs /var/squid/cache/squid 100 16 256
 
 # Leave coredumps in the first cache dir
-coredump_dir /var/squid/cache/squid
+coredump_dir none
 
 #
 # Add any of your own refresh_pattern entries above these.
@@ -71,3 +71,9 @@
 refresh_pattern ^gopher:       1440    0%      1440
 refresh_pattern -i (/cgi-bin/|\?) 0    0%      0
 refresh_pattern .              0       20%     4320
+
+cache_dir ufs /home/squid/cache 2048 64 256
+access_log /home/squid/logs/access.log squid
+cache_store_log none

Initialize

# squid -z

Start

# service squid start

 

Comments