Cách Setup Proxy Server trên VPS: Hướng Dẫn Cài Squid (Ubuntu / CentOS)


1. Squid Proxy là gì?

Squid Proxy là một proxy server phổ biến, hỗ trợ:

  • HTTP / HTTPS

  • Giấu IP thật, đổi IP theo VPS

  • Kiểm soát truy cập theo IP, user

  • Tối ưu băng thông & cache

👉 Thường dùng để:

  • Fake IP trình duyệt

  • Chạy Ads, nuôi tài khoản

  • Web scraping

  • Kết hợp proxy xoay / proxy dân cư


2. Chuẩn bị trước khi cài đặt

✔ VPS Linux (Ubuntu 20.04 / 22.04 hoặc CentOS 7)
✔ Có IP tĩnh riêng
✔ Đăng nhập VPS bằng root hoặc user có quyền sudo


3. Cài Squid Proxy trên Ubuntu

Bước 1: Update hệ thống

apt update && apt upgrade -y

Bước 2: Cài Squid

apt install squid -y

Bước 3: Backup file cấu hình

cp /etc/squid/squid.conf /etc/squid/squid.conf.bak

Bước 4: Cấu hình Squid cơ bản

Mở file config:

nano /etc/squid/squid.conf

Xóa nội dung cũ, dán cấu hình đơn giản sau:

http_port 3128 acl localhost src 127.0.0.1 acl allowed_ip src YOUR_IP http_access allow allowed_ip http_access allow localhost http_access deny all cache deny all

👉 Thay YOUR_IP bằng IP máy bạn dùng proxy.

Bước 5: Khởi động Squid

systemctl restart squid systemctl enable squid

Bước 6: Mở port Firewall (nếu có UFW)

ufw allow 3128 ufw reload

📌 Proxy sử dụng:

IP_VPS:3128

4. Cài Squid Proxy trên CentOS 7

Bước 1: Cài EPEL Repo

yum install epel-release -y

Bước 2: Cài Squid

yum install squid -y

Bước 3: Backup cấu hình

cp /etc/squid/squid.conf /etc/squid/squid.conf.bak

Bước 4: Chỉnh file cấu hình

nano /etc/squid/squid.conf

Thêm vào cuối file:

http_port 3128 acl allowed_ip src YOUR_IP http_access allow allowed_ip http_access deny all

Bước 5: Khởi động Squid

systemctl start squid systemctl enable squid

Bước 6: Mở port firewall

firewall-cmd --permanent --add-port=3128/tcp firewall-cmd --reload

5. Test Proxy Squid

Test nhanh bằng terminal:

curl --proxy http://IP_VPS:3128 ifconfig.me

👉 Nếu trả về IP VPS là OK 🎉


6. Cấu hình Proxy có User/Password (Basic Auth)

Tạo user proxy

apt install apache2-utils -y # Ubuntu htpasswd -c /etc/squid/passwd user1

Thêm vào squid.conf

auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwd auth_param basic realm Proxy acl authenticated proxy_auth REQUIRED http_access allow authenticated

Restart Squid:

systemctl restart squid

📌 Proxy dạng:

user:pass@IP_VPS:3128

7. Lưu ý khi dùng Squid trên VPS

⚠ Không nên share proxy công khai
⚠ Không dùng Squid cho HTTPS traffic lớn (Ads mạnh nên dùng SOCKS5)
⚠ Nếu chạy số lượng lớn → nên dùng Proxy dân cư / Proxy xoay IP


8. Giải pháp mạnh hơn Squid Proxy VPS

Nếu bạn:

  • Chạy Ads Facebook / Google

  • Nuôi tài khoản số lượng lớn

  • Tránh checkpoint / block IP

👉 Khuyên dùng Proxy Dân Cư / Proxy Xoay IP tự động

  • IP sạch

  • Độ trust cao

  • Không chung IP với người khác

🔗 Tham khảo: Proxy dân cư & Proxy xoay IP chất lượng cao tại ProxyGame.VN


9. Tổng kết

✔ Squid phù hợp test, học, dùng cá nhân
✔ Dễ cài – miễn phí – kiểm soát tốt
✔ Với nhu cầu MMO chuyên nghiệp → nên dùng proxy thương mại

Website thuộc bản quyền Cty TNHH Dịch Vụ ProxyGame