开源Squid Proxy Server 设置

设置Squid的目的当你在企业内部,Internet断掉的情况下,你可以默认路由走别的路径出去,比如从Squid 所在网络出口出去

Part 1. restart the squid service

the squid path is working in /usr/local/squid/sbin/squid
Configuration file /usr/local/squid/etc/squid.conf

sudo ./squid -s <--- start the process
sudo ./squid -k reconfigure <----to reload the proces

Part 2, Setup the squid on Redhat

1 . Linux system with gcc compiler and yum function

  1. sudo ./configure sudo make sudo make install

  2. setup the conf file.
    configuration file /usr/local/squid/etc/squid.conf

add acl local src 135.36.0.0/16
*Adapt localnet in the ACL section to list your (internal) IP networks

  • from where browsing should be allowed
    http_access allow localnet
    http_access allow localhost
    #*And finally deny all other access to this proxy
    http_access deny all

  • Squid normally listens to port 3128
    #http_port 3128
    http_port 8000

#*Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /usr/local/squid/var/cache/squid 100 16 256
cache deny all <--- do not use cache mode

  • we are using port 8000, you can see that sudo netstat -tulnp |grep squid
  1. change the /usr/local/squid/var to 777, so nobody account can read and
    write log to
    /usr/local/squid/var/logs/
    sudo chmod -Rvf 777 /usr/local/squid/var

  2. shutdown the firewall, sudo service iptables stop and sudo chkconfig
    iptables off
    and make sure the firewall allow network to communication with this DMZ
    zone server

  3. add to startup script so the squid service will auto start after the system
    start
    -bash-4.1$ cat /etc/rc.local

#!/bin/sh

#This script will be executed after* all the other init scripts.

  • You can put your own initialization stuff in here if you don't
  • want to do the full Sys V style init stuff.
    touch /var/lock/subsys/local
    /usr/local/squid/sbin/squid -s
  1. add cron job to nobody account so to rotate the log
    sudo crontab -u nobody -e

    0 4 * /usr/local/squid/sbin/squid -k rotate <--- add this line

  2. sudo ./squid -s <--- start the process

    9.
    /usr/local/squid/bin/squidclient -p 8000 http://www.google.com <----test if
    squid is working

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值