TinyProxy 和 Squid 都是比較優秀的代理軟件html
TinyProxy比較小衆,雖然沒有Squid的功能豐富,可是小巧簡單,也能知足通常的用戶需求。python
Squid 是一款優秀的代理軟件,有很豐富的ACL管理功能,雖然squid很強大,但配置較繁瑣bash
yum install -y tinyproxy服務器
# 啓動網絡
service tinyproxy startdom
# 中止測試
service tinyproxy stopui
# 重啓代理
service tinyproxy restartrest
默認配置文件路徑
/etc/tinyproxy/tinyproxy.conf
容許全部人使用代理,註釋 Allow 127.0.0.1
# Allow 127.0.0.1
修改監聽端口號, 默認 8888
Port 8888
代理請求過濾,示例:僅容許代理請求 anoyi.com 的內容,配置以下:
# 指定過濾內容的文件位置
Filter "/etc/tinyproxy/filter"
# 使用 URL 過濾而不是 domains
FilterURLs On
# 容許代理過濾文件裏的地址,若不容許,此處設置爲 No
FilterDefaultDeny Yes
而後在 /etc/tinyproxy/filter 文件添加以下內容:
anoyi.com
查看代理請求日誌
tail -f /var/log/tinyproxy/tinyproxy.log
編輯/etc/yum.conf,在最後加入
# Proxy
proxy=http://username:password@proxy_ip:port/
編輯/etc/wgetrc,在最後加入
# Proxy
http_proxy=http://username:password@proxy_ip:port/
ftp_proxy=http://username:password@proxy_ip:port/
若是須要爲某個用戶設置一個系統級的代理,能夠在~/.bash_profile中設置:
http_proxy="http://username:password@proxy_ip:port"
export http_proxy
圖形界面, 」網絡管理「->「網絡代理」,在那裏設置就能夠達到所有流量代理。
非圖形界面下設置全機上網,設置的環境變量.
export http_proxy=http://10.0.0.203:8888/ export FTP_PROXY=http://10.0.0.203:8888/ export ftp_proxy=http://10.0.0.203:8888/ export all_proxy=socks://10.0.0.203:8888/ export ALL_PROXY=socks://10.0.0.203:8888/ export HTTPS_PROXY=http://10.0.0.203:8888/ export https_proxy=http://10.0.0.203:8888/ export HTTP_PROXY=http://10.0.0.203:8888/ export no_proxy=localhost,127.0.0.1
永久設置直接在/etc/profile或者是~/.bash_profile文件末尾加上這些, 加載下配置 source /etc/profile
若是你的代理服務器要求認證,將10.0.0.203:8888 改成以下格式:
username:password@proxy_ip:port
配置完成了, 測試看看能不能上網