GNU/Linux >> Linux Esercitazione >  >> Ubuntu

Come installare e configurare Squid 3 su Ubuntu

In questo tutorial, ti mostreremo come installare e configurare Squid 3 su Ubuntu. Per chi non lo sapesse, Squid è un proxy di memorizzazione nella cache per il Web che supporta HTTP, HTTPS, FTP e altro ancora. Il proxy Squid viene utilizzato da varie organizzazioni e provider Internet per ridurre la larghezza di banda e aumentare i tempi di risposta.

Questo articolo presuppone che tu abbia almeno una conoscenza di base di Linux, sappia come usare la shell e, soprattutto, che ospiti il ​​tuo sito sul tuo VPS. L'installazione è abbastanza semplice e presuppone che tu sono in esecuzione nell'account root, in caso contrario potrebbe essere necessario aggiungere 'sudo ' ai comandi per ottenere i privilegi di root.

Installa e configura Squid 3 su Ubuntu

Passaggio 1. Innanzitutto, assicurati che tutti i pacchetti di sistema siano aggiornati eseguendo il seguente apt-get comandi nel terminale.

sudo apt-get update
sudo apt-get upgrade

Passaggio 2. Installazione di Squid 3 su Ubuntu.

Installa il pacchetto squid e le dipendenze usando il comando seguente:

apt-get -y install squid3

Passaggio 3. Modifica il file di configurazione di squid '/etc/squid/squid.conf'

nano /etc/squid3/squid.conf
# Recommended minimum configuration:
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid3/squid_passwd
acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users

acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl SSL_ports port 443
acl Safe_ports port 80            # http
acl Safe_ports port 21            # ftp
acl Safe_ports port 443           # https
acl Safe_ports port 1025-65535    # unregistered ports
acl Safe_ports port 280           # http-mgmt
acl Safe_ports port 488           # gss-http
acl Safe_ports port 591           # filemaker
acl Safe_ports port 777           # multiling http
acl SSL_ports port 9001           # webmin
acl CONNECT method CONNECT

http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny all
http_port 3128

#Setting up multiple outgoing IP addresses
#acl godet myip 192.168.1.100
#tcp_outgoing_address 192.168.1.100 godet
#acl jaran myip 192.168.1.101
#tcp_outgoing_address 192.168.1.101 jaran

hierarchy_stoplist cgi-bin ?
coredump_dir /var/spool/squid3
cache deny all

refresh_pattern ^ftp:        1440    20%    10080
refresh_pattern ^gopher:    1440    0%    1440
refresh_pattern -i (/cgi-bin/|\?) 0    0%    0
refresh_pattern .        0    20%    4320

icp_port 3130

forwarded_for off

request_header_access Allow allow all
request_header_access Authorization allow all
request_header_access Proxy-Authorization allow all
request_header_access Proxy-Authenticate allow all
request_header_access Cache-Control allow all
request_header_access Content-Encoding allow all
request_header_access Content-Length allow all
request_header_access Content-Type allow all
request_header_access Date allow all
request_header_access Expires allow all
request_header_access Host allow all
request_header_access If-Modified-Since allow all
request_header_access Last-Modified allow all
request_header_access Location allow all
request_header_access Pragma allow all
request_header_access Accept allow all
request_header_access Accept-Charset allow all
request_header_access Accept-Encoding allow all
request_header_access Accept-Language allow all
request_header_access Content-Language allow all
request_header_access Mime-Version allow all
request_header_access Retry-After allow all
request_header_access Title allow all
request_header_access Connection allow all
request_header_access Proxy-Connection allow all
request_header_access User-Agent allow all
request_header_access Cookie allow all
request_header_access All deny all
visible_hostname idroot.us

Passaggio 4. Crea il nostro file di autenticazione che Squid può utilizzare per verificare le autenticazioni degli utenti:

htpasswd -b /etc/squid3/squid_passwd username password

Esempio:

htpasswd -b -c /etc/squid3/squid_passwd ranty ratna

Passaggio 5. Dopo aver apportato modifiche al file di configurazione, salva il file e riavvia il servizio squid server per apportare le modifiche utilizzando il seguente comando immesso al prompt del terminale:

service squid3 restart

In caso di problemi, puoi controllare access.log per ulteriori informazioni:

sudo tail -f /var/log/squid3/access.log

Congratulazioni! Hai installato con successo Squid. Grazie per aver utilizzato questo tutorial per installare il proxy di memorizzazione nella cache di Squid nel sistema Ubuntu. Per ulteriore aiuto o informazioni utili, ti consigliamo di controllare il sito Web ufficiale di Squid.


Ubuntu
  1. Come installare e configurare Redis su Ubuntu 18.04

  2. Come installare e configurare Redmine su Ubuntu 18.04

  3. Come installare e configurare Squid Proxy su Ubuntu 20.04

  4. Come installare e configurare Squid 3 su CentOS

  5. Come installare Squid Proxy su Ubuntu 20.04 LTS

Come installare e configurare GitLab su Ubuntu 16.04

Come installare e configurare Cacti su Ubuntu 20.04

Come installare e configurare Git su Ubuntu 20.04

Come installare e configurare OpenVAS 9 su Ubuntu

Come installare e configurare Redis in Ubuntu 20.04

Come installare e configurare Neo4j su Ubuntu 20.04