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

Kingate 代理服務器安裝與配置完整教學(支援 HTTP/SOCKS/FTP)

編輯:Linux 教學

前言

Kingate 是一款由國人開發的高效能代理服務器軟體,支援 HTTP、SOCKS4/5、FTP、POP3、SMTP、TELNET、MMS、RTSP 等多種協議,具備多線程、TCP 連接埠映射、規則/時間控制、使用者認證及 Web 管理介面等豐富功能。本文記錄從原始碼編譯安裝到生產環境部署的完整流程。

官方資源

專案首頁:https://sourceforge.net/projects/kingate/

一、安裝相依套件

Debian/Ubuntu 系列

apt-get update && apt-get install -y build-essential automake make gcc g++

CentOS/RHEL 系列

yum install -y make automake gcc gcc-c++ gcc-g77

二、下載、編譯與安裝

wget https://softlayer.dl.sourceforge.net/project/kingate/kingate/2.2/kingate-2.2.tar.gz
tar xzf kingate-2.2.tar.gz
cd kingate-2.2/
./configure --prefix=/usr/local/kingate
make && make install

三、核心配置檔設定(/usr/local/kingate/etc/kingate.conf)

以下為生產環境常用的精簡配置範例,啟用 SOCKS5 代理與 Web 管理,其餘協議關閉:

http off
ftp off
pop3 off
smtp off
telnet off
socks on
mms off
rtsp off
manage on

max 2000
max_per_ip 0
min_free_thread 3

http_port 8082
http_accelerate off
x_forwarded_for on
http_time_out 30

ftp_port 2121
ftp_time_out 300

pop3_port 1100
pop3_time_out 300

smtp_port 2525
smtp_time_out 300

telnet_port 2323
telnet_time_out 300

socks_port 20120
socks_time_out 300
socks5_user off

mms_port 1755
mms_time_out 300

rtsp_port 5540
rtsp_time_out 300

manage_port 2222
manage_time_out 300

log_model user
log_level 0
log_rotate {0 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 * * * }
log_close_msg on

mem_min_cache 50m
mem_max_cache 12m
disk_min_cache 20m
disk_max_cache 30m
use_disk_cache off
refresh never
refresh_time 300
user_time_out 0
mem_cache 50m
disk_cache 100m
max_deny_per_ip 0
max_queue_thread 15
min_limit_speed_size 1m
limit_speed 20k
max_request 50
total_seconds 10
bind_addr
run_user
insert_via off

關鍵參數說明:

  • socks on:啟用 SOCKS 代理(含 SOCKS5)。
  • socks_port 20120:SOCKS 服務監聽連接埠(強烈建議修改預設連接埠)。
  • manage on / manage_port 2222:啟用 Web 管理介面及其連接埠。

四、服務管理腳本部署

wget https://soft.vpser.net/proxy/kingate/kingate.init.d
mv kingate.init.d /etc/init.d/kingate
chmod +x /etc/init.d/kingate

五、常用服務控制指令

操作指令
啟動/etc/init.d/kingate start
停止/etc/init.d/kingate stop
重啟/etc/init.d/kingate restart

六、Web 管理介面存取

瀏覽器開啟 https://<Server_IP>:2222,預設帳號 root,密碼 kingate(請立即修改)。

七、設定開機自啟

Debian/Ubuntu

update-rc.d -f kingate defaults

CentOS/RHEL

chkconfig --level 345 kingate on

安全性提醒

  • 務必修改預設管理連接埠(2222)與 SOCKS 連接埠(20120)。
  • 啟用 socks5_user on 並設定強密碼,避免開放代理被濫用。
  • 配合防火牆(iptables/firewalld)僅允許信任 IP 存取管理介面與代理連接埠。
Copyright © Windows教程網 All Rights Reserved