📄 1513.html
字号:
<TD background="images/bgi.gif" tppabs="http://www.linuxhero.com/docs/images/bgi.gif"
height=30></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=3 width="95%"
align=center border=0>
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%"
border=0>
<TBODY>
<TR>
<TD vAlign=top>
<p><FONT class=normalfont><B><font color=blue>squid 2.5 stable快速安装指南</font></B></FONT><BR><FONT class=smallfont color=#ff9900>2004-04-23 15:18 pm</FONT><BR><FONT class=normalfont>作者:阿土/Aborigen Yin<br>来自:Linux知识宝库<br>联系方式:无名<br><br>目标:在网关上为内网提供普通代理以及透明代理服务,以ip地址为访问控制条件,不需要其他访问控制。<br>
<br>
#安装<br>
<br>
#如果是FreeBSD,建议安装如下ports:<br>
cd /usr/ports/devel/autoconf<br>
make clean<br>
make install clean<br>
<br>
cd /usr/ports/devel/automake<br>
make clean<br>
make install clean<br>
<br>
#首先,配置好你的网络,保证安装squid的主机能正常上网;<br>
ping www.163.com<br>
#用域名是为了测试DNS解析;<br>
<br>
#以下以root身份执行。<br>
#获得最新stable源码<br>
http://www.squid-cache.org<br>
<br>
mkdir -p /usr/local/src/distfiles<br>
cd /usr/local/src/distfiles<br>
#FreeBSD<br>
fetch http://www.squid-cache.org/Versions/v2/2.5/squid-2.5.STABLE1.tar.gz<br>
#Linux<br>
wget http://www.squid-cache.org/Versions/v2/2.5/squid-2.5.STABLE1.tar.gz<br>
<br>
tar xfz squid-2.5.STABLE1.tar.gz -C ..<br>
<br>
cd ../squid-2.5.STABLE1<br>
./configure --prefix=/usr/local/squid<br>
make<br>
make install<br>
<br>
#权限改变是必要的;参考squid.conf<br>
#cache_effective_user nobody<br>
#cache_effective_group nobody<br>
#默认使用<br>
chown -R nobody:nobody /usr/local/squid/var<br>
<br>
#按照你的需要配置;<br>
#vi /usr/local/squid/etc/squid.conf<br>
# TAG: http_port<br>
# Usage: port<br>
# hostname:port<br>
# 1.2.3.4:port<br>
#Default:<br>
# http_port 3128<br>
http_port 60080<br>
#逃避讨厌的代理扫描,使用一个自定义的端口;<br>
<br>
#设置不代理的url,一些动态网页,比如江湖、聊天室。<br>
# TAG: no_cache<br>
# A list of ACL elements which, if matched, cause the request to<br>
# not be satisfied from the cache and the reply to not be cached.<br>
# In other words, use this to force certain objects to never be cached.<br>
#<br>
# You must use the word 'DENY' to indicate the ACL names which should<br>
# NOT be cached.<br>
#<br>
#We recommend you to use the following two lines.<br>
acl QUERY urlpath_regex cgi-bin ? asp php shtml php3 cgi<br>
no_cache deny QUERY<br>
<br>
<br>
# ACCESS CONTROLS<br>
# -----------------------------------------------------------------------------<br>
<br>
# TAG: acl<br>
# Defining an Access List<br>
#<br>
# acl aclname acltype string1 ...<br>
# acl aclname acltype "file" ...<br>
#<br>
# when using "file", the file should contain one item per line<br>
#定义内网(假设有172.16.0.0/16;192.168.0.0/16;10.0.0.0/8);<br>
acl lan-a src 172.16.0.0/16<br>
acl lan-b src 192.168.0.0/16<br>
acl lan-c src 10.0.0.0/8<br>
<br>
#squid的默认配置是拒绝所有连接;<br>
#Default:<br>
# http_access deny all<br>
#<br>
#对上述内网地址开放<br>
http_access allow lan-a<br>
http_access allow lan-b<br>
http_access allow lan-c<br>
<br>
#Recommended minimum configuration:<br>
#<br>
<br>
#以下设置透明代理,如果你不用透明代理,可以跳过。<br>
#在网关的防火墙上设置重定向,把内网对80的访问请求重定向到squid:<br>
#Ipfilter rules<br>
#rdr $LAN_NIC 0/0 port 80 -> $SQUID_HOST_ADDR port $SQUID_PROXY_PORT tcp<br>
#Iptables rules<br>
#iptables -t nat -A PREROUTING -i $LAN_NIC -p tcp -m tcp --dport 80 -j DNAT --to $SQUID_HOST_ADDR:$SQUID_PROXY_PORT<br>
#限定对指定来源的请求做重定向;<br>
#iptables -t nat -A PREROUTING -i $LAN_NIC -p tcp -m tcp -s $INTERNAL_NETWORK/$INTERNAL_MASK --dport 80 -j DNAT --to $SQUID_HOST_ADDR:$SQUID_PROXY_PORT<br>
#启用透明代理<br>
httpd_accel_host virtual<br>
httpd_accel_port 80<br>
httpd_accel_with_proxy on<br>
#作透明代理的同时缓存<br>
#注意下面一行,默认是off的.<br>
httpd_accel_uses_host_header on<br>
<br>
<br>
#初始化缓冲目录<br>
/usr/local/squid/sbin/squid -z<br>
<br>
#开机关机管理脚本<br>
#vi /usr/local/sbin/squid.sh<br>
<br>
#!/bin/sh<br>
case "$1" in<br>
<br>
start)<br>
if [ -x /usr/local/squid/sbin/squid ]; then<br>
/usr/local/squid/sbin/squid && echo . && echo 'Squid proxy server started.'<br>
fi<br>
;;<br>
<br>
stop)<br>
killall squid && echo . && echo 'Squid proxy server stopped.'<br>
;;<br>
restart)<br>
echo .<br>
echo "Restart Squid proxy server ......"<br>
$0 stop<br>
sleep 30<br>
$0 start<br>
;;<br>
*)<br>
echo "$0 start | stop | restart"<br>
;;<br>
<br>
esac<br>
#end of /usr/local/sbin/squid.sh<br>
<br>
chmod 700 /usr/local/sbin/squid.sh<br>
<br>
#开机自动执行<br>
#FreeBSD<br>
ln -s /usr/local/sbin/squid.sh /usr/local/etc/rc.d<br>
#Linux<br>
ln -s /usr/local/sbin/squid.sh /etc/rc.d/rc3.d/S99Squid-prxoy<br>
#注意:有些linux发行版本默认安装有squid,如果你不喜欢默认的,砍吧。<br>
<br>
<br>
<br>
我觉得很容易配,在SQUID.CONF中,主要的改一行<br>
http_port 3128 ,将这行的前面的#去掉,<br>
然后在客户端的浏览器的连接设置成这个主机的地址和这个端口就可以了,<br>
当然这个端口可以由你定一个与系统不冲突的端口.<br>
在执行squid -NCd1 前,别忘了执行squid -z
</FONT><br>
</TD>
</TR>
<TR>
<TD colSpan=2><FONT
class=middlefont></FONT><BR>
<FONT
class=normalfont>全文结束</FONT> </TD>
</TR>
<TR>
<TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top width="20%"
background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2>
<DIV align=center>
<table class=tableoutline cellspacing=1 cellpadding=4
width="100%" align=center border=0>
<tr class=firstalt>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
<font class=normalfont><b>所有分类</b></font></td>
</tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td> </tr> </table></td></tr> </table>
</DIV></TD></TR>
<TR vAlign=top>
<TD width="80%">
<DIV align=center><BR>
</DIV>
</TD></TR></TBODY></TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee
border=0><TBODY>
<TR>
<TD width="50%">
<P><FONT class=middlefont>版权所有 © 2004 <A
href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
违者必究. </FONT></P>
</TD>
<TD width="50%">
<DIV align=right><FONT class=middlefont>Powered by: <A
href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
</TD></TR></TBODY></TABLE>
<CENTER></CENTER></TD></TR>
</TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -