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 作為 SSH 代理伺服器UI伺服器
- Webapck 簡單配置Web
- squidUI
- VS code 簡單配置
- logback的簡單配置
- spingMVC框架簡單配置MVC框架
- Web Scraper簡單配置方法Web
- webpack(簡單安裝配置)Web
- 一個簡單多庫配置
- 交換機的簡單配置
- node webpack4.6簡單配置Web
- 一個簡單vue.config.js配置和axios簡單封裝VueJSiOS封裝
- 伺服器簡單郵箱配置伺服器
- Elasticsearch 的安裝和簡單配置Elasticsearch
- Django安裝與簡單配置(1)Django
- CentOS 7 以上防火牆簡單配置CentOS防火牆
- Spring Cloud Gateway + Nacos(1)簡單配置SpringCloudGateway
- 配置中心之Nacos簡介,使用及Go簡單整合Go
- Mybatis【配置檔案】就是這麼簡單MyBatis
- 把玩Alpine linux(三):簡單手動配置Linux
- webpack4簡單實用配置解析Web
- 簡單說說webpack的配置檔案Web
- log4j簡單配置解釋
- Ubuntu-kali配置動態ip(簡單)Ubuntu
- 01 . SaltStack部署配置及簡單應用
- Linux伺服器---squid限制Linux伺服器UI
- CentOS搭建squid正向代理教程。CentOSUI
- Gulp4 Koa專案簡單配置示例
- PostgreSQLlibpqmulti-host配置與簡單HA實現SQL
- TS3AudioBot的簡單安裝配置S3
- jenkins簡單安裝及配置(Windows環境JenkinsWindows
- Linux伺服器---squid快取Linux伺服器UI快取
- Linux伺服器---安裝squidLinux伺服器UI
- Laravel5.7+vue+element-ui 配置及簡單使用LaravelVueUI
- Mysql Master-slave複製簡單配置記錄MySqlAST
- SpringBoot獲取配置檔案,就這麼簡單。Spring Boot
- webpack介面環境切換的配置-超簡單Web
- 最簡單的SpringBoot示例之.yml配置檔案Spring Boot
- 配置一個簡單的傳統SSM專案SSM