免费观看又色又爽又黄的小说免费_美女福利视频国产片_亚洲欧美精品_美国一级大黄大色毛片

Squid代理服務器——ACL訪問控制,sarg日志,反向代理-創新互聯

實驗環境

squid服務器 ens33:192.168.13.184
                                        ens36:192.168.10.1 (僅主機模式)
web服務器 192.168.13.151
client 192.168.10.10  (僅主機模式)

一,ACL訪問控制

1,在squid服務器上修改配置文件

[root@squid ~]# vim /etc/squid.conf  ##修改配置文件
# should be allowed
acl hostlocal src 192.168.10.10/32  ##控制hostlocal10.10的主機
# Deny requests to certain unsafe ports
http_access deny hostlocal  ##拒絕訪問
[root@squid ~]# service squid reload   ##重啟squid服務

2,在測試機上訪問web網頁

Squid代理服務器——ACL訪問控制,sarg日志,反向代理

創新互聯服務項目包括淅川網站建設、淅川網站制作、淅川網頁制作以及淅川網絡營銷策劃等。多年來,我們專注于互聯網行業,利用自身積累的技術優勢、行業經驗、深度合作伙伴關系等,向廣大中小型企業、政府機構等提供互聯網行業的解決方案,淅川網站推廣取得了明顯的社會效益與經濟效益。目前,我們服務的客戶以成都為中心已經輻射到淅川省份的部分城市,未來相信會繼續擴大服務區域并繼續獲得客戶的支持與信任!

二,sarg日志

1,在squid服務器上安裝sarg

[root@squid ~]# mount.cifs //192.168.100.3/LNMP-C7 /mnt/  ##掛載
Password for root@//192.168.100.3/LNMP-C7:  
[root@squid ~]# cd /mnt/
[root@squid mnt]# tar zxvf sarg-2.3.7.tar.gz -C /opt/   ##解壓
[root@squid mnt]# cd /opt/sarg-2.3.7/
[root@squid sarg-2.3.7]# yum install gd gd-devel -y  ##安裝gd庫
[root@squid sarg-2.3.7]# ./configure --prefix=/usr/local/sarg \  ##安裝路徑
> --sysconfdir=/etc/sarg \   ##配置文件
> --enable-extraprotection  ##開啟安全防護
[root@squid sarg-2.3.7]# make && make install  ##編譯安裝

2,修改sarg配置文件

[root@squid sarg-2.3.7]# vim /etc/sarg/sarg.conf  ##修改sarg配置文件
##將下面的模塊修改開啟
access_log /usr/local/squid/var/logs/access.log  ##指定訪問日志文件
title "Squid User Access Reports"  ##網頁標題
output_dir /var/www/html/squid-reports  ##報告輸出目錄
user_ip no  ##使用用戶名顯示
exclude_hosts /usr/local/sarg/noreport  ##不計入排序的站點列表文件
topuser_sort_field connect reverse  
##top排序中有連接次數,訪問字節,降序排列,升序是normal
overwrite_report no  ##同名日志是否覆蓋
mail_utility mailq.postfix  ##發送郵件報告命令
charset UTF-8  ##使用字符集
weekdays 0-6  ##top排行的時間周期
hours 0-23  ##top排行的時間周期
www_document_root /var/www/html  ##網頁根目錄
[root@squid ~]# sarg   ##生成報告
SARG: 紀錄在文件: 91, reading: 100.00%
SARG: 成功的生成報告在 /var/www/html/squid-reports/2019Dec11-2019Dec12
[root@squid sarg-2.3.7]# cd /var/www/html/squid-reports/  ##切換到html目錄下
[root@squid squid-reports]# ls
2019Dec11-2019Dec12   images  index.html
[root@squid squid-reports]# yum install httpd -y  ##安裝httpd服務
[root@squid squid-reports]# systemctl start httpd.service  ##開啟服務
[root@squid squid-reports]# systemctl stop firewalld.service   ##關閉防火墻
[root@squid squid-reports]# setenforce 0

3,用測試機訪問網頁查看訪問記錄

Squid代理服務器——ACL訪問控制,sarg日志,反向代理

##周期性計劃任務執行每天生成報告crontab
sarg -l /usr/local/squid/var/logs/access.log -o /var/www/html/squid-reports/ -z -d $(date -d "1 day ago" +%d/%m/%Y)-$(date +%d/%m/%Y)

Squid代理服務器——ACL訪問控制,sarg日志,反向代理

三,squid反向代理

squid服務器 ens33:192.168.13.184
                                        ens36:192.168.10.1 (僅主機模式)
web1服務器 192.168.13.151
web2服務器 192.168.13.185
client 192.168.10.10  (僅主機模式)

1,在web1服務器上編輯一個網頁內容

[root@web ~]# cd /var/www/html/
[root@web html]# vim index.html  ##編輯網頁內容
<h2>this is test web!</h2>

2,在測試機上訪問網頁

Squid代理服務器——ACL訪問控制,sarg日志,反向代理

3,在web2服務器上編輯一個網頁內容

[root@web2 ~]# systemctl stop firewalld.service   ##關閉防火墻
[root@web2 ~]# setenforce 0
[root@web2 ~]# yum install httpd -y   ##安裝httpd服務
[root@web2 ~]# cd /var/www/html/   ##創建網頁內容
[root@web2 html]# vim index.html
<h2>this is test2 web!</h2>
[root@web2 html]# systemctl start httpd.service

4,在squid服務上配置反向代理

[root@localhost squid]# vim /etc/squid.conf
# Squid normally listens to port 3128
http_port 192.168.13.184:80 accel vhost vport ##監控本機80端口
cache_peer 192.168.13.151 parent 80 0 no-query originserver round-robin max_conn=30 weight=1 name=web1
##節點服務器1大訪問30,權重1,別名web1
cache_peer 192.168.13.185 parent 80 0 no-query originserver round-robin max_conn=30 weight=1 name=web1
cache_peer_domain web1 web2 www.yun.com  ##訪問yun.com匹配web1,web2節點
[root@localhost squid]# service squid restart  ##重啟squid服務

5,在測試機的admin用戶下配置解析域名地址,并設置代理

Squid代理服務器——ACL訪問控制,sarg日志,反向代理
Squid代理服務器——ACL訪問控制,sarg日志,反向代理
Squid代理服務器——ACL訪問控制,sarg日志,反向代理
Squid代理服務器——ACL訪問控制,sarg日志,反向代理

謝謝閱讀!

另外有需要云服務器可以了解下創新互聯cdcxhl.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業上云的綜合解決方案,具有“安全穩定、簡單易用、服務可用性高、性價比高”等特點與優勢,專為企業上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

當前題目:Squid代理服務器——ACL訪問控制,sarg日志,反向代理-創新互聯
標題鏈接:http://m.newbst.com/article32/dcecpc.html

成都網站建設公司_創新互聯,為您提供網站營銷移動網站建設電子商務網站收錄外貿網站建設網站改版

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

網站托管運營