squid 簡單配置
配置squid讓同網段內的其他機器可以使用
一,安裝:
[root@station10 ~]# yum -y install squid
二,啟動預設配置:
[root@station10 ~]# chkconfig squid on
[root@station10 ~]# service squid start
Starting squid: .[ OK ]
[root@station10 ~]#
三,預設的配置資訊:
http_port 3128
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin ?
cache deny QUERY
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
access_log /var/log/squid/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
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.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
http_reply_access allow all
icp_access allow all
coredump_dir /var/spool/squid
四,檢視訪問的資訊:
[root@station10 ~]# tail -f /var/log/squid/access.log
1224506740.327 354 127.0.0.1 TCP_REFRESH_HIT/304 307 GET http://192.168.0.10/ - DIRECT/192.168.0.10 -
1224506746.019 44 192.168.0.12 TCP_DENIED/403 1452 GET - NONE/- text/html
本機可以訪問,其他機器不能訪問
五,設定iptables
[root@station10 ~]# iptables -I INPUT -s 192.168.0.0/24 -p tcp --dport 3128 -j ACCEPT
[root@station10 ~]# service iptables save
Saving firewall rules to /etc/sysconfig/iptables: [ OK ]
[root@station10 ~]# iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 192.168.0.0/24 anywhere tcp dpt:squid
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain RH-Firewall-1-INPUT (0 references)
target prot opt source destination
[root@station10 ~]#
六, 編輯squid檔案,讓同子網內可以使用
1,在acl CONNECT method CONNECT下面新增:
acl example src 192.168.0.0/24
2,在# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS行下面新增:
http_access allow example
3,重新匯入配置:
[root@station10 squid]# service squid reload
[root@station10 squid]#
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/312079/viewspace-1012148/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Squid基礎與配置(轉)UI
- Webapck 簡單配置Web
- 簡單配置ASMASM
- squid 配置詳解+認證(轉)UI
- VS code 簡單配置
- SELinux簡單配置Linux
- mysql cluster 簡單配置MySql
- Web Scraper簡單配置方法Web
- spingMVC框架簡單配置MVC框架
- VsCode簡單配置VSCode
- webpack(簡單安裝配置)Web
- LINUX FTP簡單配置LinuxFTP
- Redhat 簡單本地yum 配置Redhat
- Windows下Subversion簡單配置Windows
- VSFTP的簡單配置FTP
- Linux NTP 簡單配置Linux
- 配置 Squid 作為 SSH 代理伺服器UI伺服器
- 一個簡單多庫配置
- node webpack4.6簡單配置Web
- window下mongodb的簡單配置MongoDB
- 簡單安裝配置lighttpdhttpd
- 簡單的ANT配置檔案
- RedHat6.2簡單配置dhcpRedhat
- 簡單配置PostFix伺服器伺服器
- mysql goldengate同步 簡單配置MySqlGo
- postfix安裝和簡單配置
- linux bind dns簡單配置LinuxDNS
- squidUI
- 高效配置Linux代理伺服器Squid介紹Linux伺服器UI
- Django安裝與簡單配置(1)Django
- Elasticsearch 的安裝和簡單配置Elasticsearch
- 伺服器簡單郵箱配置伺服器
- CentOS 7 以上防火牆簡單配置CentOS防火牆
- samba伺服器的簡單配置Samba伺服器
- mysql_to_mysql的gg簡單配置MySql
- CentOS 7 Docker 防火牆簡單配置CentOSDocker防火牆
- postgresql 9.4 流複製簡單配置SQL
- oracle全文索引的簡單配置Oracle索引