CentOS上用Squid搭建HTTP代理小結

來源:互聯網
上載者:User

安裝Squid

yum install squid -y# -y 代表自動選擇y,全自動安裝
安裝後,可以自訂http代理連接埠,設定來源IP白名單等
vi /etc/squid/squid.conf# ------ 自訂http連接埠:# Squid normally listens to port 3128http_port 8088# ------ 設定來源IP白名單,增加的這兩行要在 http_access deny all 前面acl client src 122.55.87.125http_access allow client# And finally deny all other access to this proxyhttp_access deny all
預設squid的access日誌裡的時間為unix時間戳記,不方便閱讀,可以通過在 /etc/squid/squid.conf 增加一行logformat配置:
#此行加在設定檔末尾即可#access log time human-readablelogformat squid %tl.%03tu %6tr %>a %Ss/%03>Hs %<st %rm %ru %un %Sh/%<A %mt
修改完設定檔後,reload即可生效:
/etc/init.d/squid reload#另外啟動和重啟命令/etc/init.d/squid start/etc/init.d/squid restart
如果想在防火牆層級就限定只允許白名單IP訪問代理連接埠:
vi /etc/sysconfig/iptables-A INPUT -s 122.55.87.125 -p tcp -m tcp --dport 8088 -j ACCEPTservice iptables restart

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.