# Ubuntuda SQUID proxy servisi nasıl kurulur ?

https://my.sunucumweb.com/bilgi-bankasi/makale/ubuntuda-squid-proxy-servisi-nasil-kurulur

Ubuntuda SQUID proxy nasıl kurulur ve uzak sunucudaki IP adresi ile internete nasıl çıkılır?

> Ubuntuda SQUID nasıl kurulur ve uzak sunucudaki IP adresi ile internete nasıl çıkılır?

Kullanıcı Adı: proxyuser

Parola: PAROLAM

Port: 8335

```
apt install squid apache2-utils -y
```

# Squid.conf dosyasını yedekle

```
cp /etc/squid/squid.conf /etc/squid/squid.conf.ydk
```

```
rm -rf /etc/squid/passwords
```

```
htpasswd -cb /etc/squid/passwords proxyuser PAROLAM
```

# Squid.conf dosyasını düzenle cat <<EOT >/etc/squid/squid.conf # Squid temel ayarları http_port 0.0.0.0:8335 http_access allow all # Kimlik doğrulama ayarları auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwords auth_param basic realm Squid proxy-caching web server acl authenticated proxy_auth REQUIRED http_access allow authenticated # Günlükleme ayarları access_log /var/log/squid/access.log cache_log /var/log/squid/cache.log # Önbellek ayarları cache_dir ufs /var/spool/squid 100 16 256 maximum_object_size 4096 MB cache_mem 512 MB netdb_filename none # Bağlantı sınırları acl maxconnsperip maxconn 3 http_access deny maxconnsperip # DNS ayarları dns_nameservers 8.8.8.8 8.8.4.4 dns_retransmit_interval 3 seconds dns_timeout 1 minute dns_v4_first on EOT

```
systemctl restart squid
```

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

```
#journalctl -f
```

```
#systemctl status squid
```

```
#netstat -pulten | grep 8335
```

**Python** ile **uzak sunucu**ya bağlanıp, IP adresini test etmek için aşağıdaki kodu deneyebilirsiniz.

import requests # Squid proxy sunucusunun adresi ve portu proxy_host = ’IP.AD.RE.SI’ proxy_port = ’8335’ # Proxy sunucusuna erişim için kullanıcı adı ve parola proxy_username = ’proxyuser’ proxy_password = ’PAROLAM’ # Proxy sunucusunun URL’sini oluşturun proxy_url = f’http://{proxy_username}:{proxy_password}@{proxy_host}:{proxy_port}’ # Requests kütüphanesini kullanarak Squid proxy sunucusuna bağlanın response = requests.get(’https://ipinfo.io/ip’, proxies={’http’: proxy_url, ’https’: proxy_url}) # Yanıtı kontrol edin if response.status_code == 200: print(response.text) else: print("Bağlantı hatası! Status code:", response.status_code)
