fa

سرور پروکسی روی VPS: SOCKS5 و HTTP

پروکسی SOCKS5 و HTTP ساده‌ترین و سریع‌ترین راه برای هدایت ترافیک از طریق یک سرور خارجی هستند. برخلاف VPN که کل ترافیک سیستم را تغییر می‌دهد، پروکسی‌ها می‌توانند فقط برای برنامه‌های خاص تنظیم شوند. کاربردهای رایج شامل web scraping، botting، اتصال به سرویس‌های خارجی از ایران و دور زدن محدودیت‌های IP است.

Need this done for your project?

We implement, you ship. Async, documented, done in days.

Start a Brief

نصب SOCKS5 با Dante

Dante یکی از پیاده‌سازی‌های SOCKS5 پایدار و امن است:

apt update
apt install -y dante-server

پیکربندی Dante در /etc/danted.conf:

logoutput: /var/log/danted.log

internal: 0.0.0.0 port = 1080
external: eth0

socksmethod: username
clientmethod: none

user.privileged: root
user.unprivileged: nobody

client pass {
    from: 0.0.0.0/0 to: 0.0.0.0/0
    log: error
}

socks pass {
    from: 0.0.0.0/0 to: 0.0.0.0/0
    socksmethod: username
    log: error
}
systemctl enable danted
systemctl start danted

احراز هویت کاربر برای SOCKS5

ایجاد کاربر سیستمی برای پروکسی (بدون دسترسی shell):

useradd -r -s /bin/false proxyuser
passwd proxyuser

تست اتصال از terminal:

curl -x socks5h://proxyuser:password@VPS_IP:1080 https://api.ipify.org

اگر IP سرور VPS نشان داده شد، پروکسی درست کار می‌کند.

تنظیم در Python requests:

import requests

proxies = {
    'http': 'socks5h://proxyuser:password@VPS_IP:1080',
    'https': 'socks5h://proxyuser:password@VPS_IP:1080',
}
response = requests.get('https://api.ipify.org', proxies=proxies)
print(response.text)

نصب HTTP Proxy با Squid

Squid برای HTTP/HTTPS proxy کاربردهای گسترده‌تری دارد:

apt install -y squid apache2-utils

ایجاد فایل پسورد:

htpasswd -c /etc/squid/passwd proxyuser

پیکربندی Squid در /etc/squid/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
http_access deny all

http_port 3128
dns_nameservers 1.1.1.1 8.8.8.8
systemctl enable squid
systemctl restart squid

تست:

curl -x http://proxyuser:password@VPS_IP:3128 https://api.ipify.org

تنظیمات فایروال و محدودیت دسترسی

محدود کردن دسترسی به IP‌های خاص (امن‌ترین روش):

ufw allow from YOUR_HOME_IP to any port 1080
ufw allow from YOUR_OFFICE_IP to any port 1080
ufw deny 1080

ufw allow from YOUR_HOME_IP to any port 3128
ufw deny 3128

اگر IP شما ثابت نیست، rate limiting برای جلوگیری از سوء استفاده:

# در squid.conf
delay_pools 1
delay_class 1 1
delay_parameters 1 -1/-1
delay_access 1 allow authenticated

لاگ‌های اتصالات:

tail -f /var/log/squid/access.log

VPS آفشور Anubiz Host در ایسلند IP‌های clean با هیچ blacklist ندارند - ایده‌آل برای web scraping و اتصال به سرویس‌های خارجی از ایران.

Why Anubiz Host

100% async — no calls, no meetings
Delivered in days, not weeks
Full documentation included
Production-grade from day one
Security-first approach
Post-delivery support included

Ready to get started?

Skip the research. Tell us what you need, and we'll scope it, implement it, and hand it back — fully documented and production-ready.

Anubiz Chat AI

Online