Menu ng dokumentasyon

Paano mag-install ng SQUID na proxy server

Ang pinakamabilis na paraan para magpagana ng proxy servery ay sa pamamagitan ng Docker:

Bash
          docker run --name squid -p 3128:3128 --rm -d \
-e PROXYLOGIN=mylogin \
-e PROXYPASSWORD=mypassword \
anticaptcha/squid
        

Kung gusto mo mag-set ng sarili mong file ng configuration, kung saan mo ise-setup ang awtentikasyon, kaya i-mount ito sa /etc/squid/squid.conf

Bash
          docker run --name squid -p 3128:3128 --rm -d \
-v /path/to/squid.conf:/etc/squid/squid.conf \
anticaptcha/squid
        


Isang paraan ay gumawa mula sa pinagmulan:

Bash
          yum -y install make gcc gcc-c++ libtool wget httpd-tools
wget http://www.squid-cache.org/Versions/v3/3.2/squid-3.2.3.tar.gz
tar -zxf squid-3.2.3.tar.gz
cd squid-3.2.3
./configure
make
make install
        

Halimbawa ng file ng configuration:

Bash
          #configure the port number
http_port 9191

cache_mem 5 MB
cache_dir ufs /usr/local/squid/var/cache 300 16 256
cache_access_log /usr/local/squid/var/logs/access.log
cache_log /usr/local/squid/var/logs/cache.log
cache_store_log /usr/local/squid/var/logs/store.log
pid_filename /usr/local/squid/var/logs/squid.pid



auth_param basic program /usr/local/squid/libexec/basic_ncsa_auth /usr/local/squid/etc/squid_users

auth_param basic children 5
auth_param basic realm enter_your_pass
auth_param basic credentialsttl 2 hours

error_directory /usr/local/squid/share/errors/


acl SSL_ports port 443
acl Safe_ports port 80 8080 3128 # http
acl Safe_ports port 443# https
acl CONNECT method CONNECT
acl MYUSERS proxy_auth REQUIRED
acl to_ipv6 dst ipv6


http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow net


#allow only athorized users
http_access allow MYUSERS
http_reply_access allow all
icp_access deny all
miss_access allow all


#squid will run under nobody user
cache_effective_user nobody
cache_effective_group nobody
coredump_dir /usr/local/squid/var/cache


## making it anonymous
forwarded_for transparent
request_header_access Via deny all
request_header_access X-Forwarded-For deny all
request_header_access Cache-Control deny all
        

Ang SQUID ay tinatago ang mga login at password sa hiwalay na file, sa kaso namin ito ay "/usr/local/squid/etc/squid_users". Para pangasiwaan itong file gamitin ang gamit na "htpasswd":

Bash
          htpasswd -c /usr/local/squid/etc/squid_users mylogin
        

Pagkatapos mo sa configuration, palitan ang mga permiso ng mga direktoryo ng SQUID at paganahin ito bilang daemon:

Bash
          chown -R nobody:nobody /usr/local/squid/share /usr/local/squid/var
/usr/local/squid/sbin/squid -z /usr/local/squid/etc/squid.conf
/usr/local/squid/sbin/squid -f /usr/local/squid/etc/squid.conf
        

Itsek kung ang proxy ay gumagana at tumatanggap ng mga koneksiyon:

Bash
          netstat -lenp|grep squid