Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

CentOS 部署 TinyProxy HTTP 代理伺服器快速指南

編輯:Linux 教學

TinyProxy 是輕量級 HTTP/HTTPS 代理伺服器,安裝簡單、資源佔用極低,適合個人或小型團隊透過代理存取網路資源。

安裝步驟 (CentOS 5/6/7 通用)


# 1. 安裝 EPEL 源 (CentOS 5 範例,其他版本請換對應 rpm)
rpm -Uvh https://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

# 2. 更新並安裝
yum update
yum install tinyproxy

配置檔修改 (/etc/tinyproxy/tinyproxy.conf)


Port 8888              # 監聽端口,可自行修改
Allow 127.0.0.1        # 僅允許本機,改為你的客戶端 IP (如 Allow 1.2.3.4)
# Allow 192.168.1.0/24  # 支援 CIDR 網段
# Allow all             # 前面加 # 註解則允許所有 IP (不建議生產環境)

啟動與驗證


service tinyproxy start
# 或 systemctl start tinyproxy (CentOS 7)

# 驗證端口監聽
netstat -antup | grep tinyproxy
# 輸出應包含 LISTEN 0.0.0.0:8888

瀏覽器設定代理測試

瀏覽器代理設為 伺服器IP:8888,訪問 https://ip.cn 確認出口 IP 為代理伺服器 IP。

進階設定提示

  • Bind 192.168.1.100:指定監聽介面 (多網卡時)
  • Timeout 600:連線逾時秒數
  • MaxClients 100:最大同時連線數
  • ViaProxyName tinyproxy:Via 標頭名稱
  • 啟用 Basic 認證:取消註解 BasicAuth user password
  • HTTPS CONNECT 支援:預設已啟用,無需額外設定

開機自啟


chkconfig tinyproxy on
# CentOS 7: systemctl enable tinyproxy
Copyright © Windows教程網 All Rights Reserved