ArenaStreaming
script icecast

Berikut cara mudah install Squid Proxy di Ubuntu 20.04

root@arenastreaming:/etc/squid#sudo apt update
root@arenastreaming:/etc/squid#sudo apt install squid
root@arenastreaming:/etc/squid#sudo apt-get install apache2-utils
root@arenastreaming:/etc/squid#sudo touch /etc/squid/passwords
root@arenastreaming:/etc/squid#sudo chmod 777 /etc/squid/passwords
root@arenastreaming:/etc/squid# systemctl status squid.service
● squid.service - Squid Web Proxy Server
Loaded: loaded (/lib/systemd/system/squid.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2024-03-15 21:41:39 UTC; 12min ago
Docs: man:squid(8)
Process: 43429 ExecStartPre=/usr/sbin/squid --foreground -z (code=exited, status=0/SUCCESS)
Process: 43432 ExecStart=/usr/sbin/squid -sYC (code=exited, status=0/SUCCESS)
Main PID: 43433 (squid)
Tasks: 5 (limit: 2292)
Memory: 21.4M

Edit file config squid.conf sesuai kebutuhan, file squid.conf bisa di temukan di folder /etc/squid. Dalam contoh kali ini saya akan menggunakan konfigurasi yang simple., berikut konfigurasinya :

#
# Recommended minimum configuration:
#

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed

# Auth
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid/passwords
acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users


acl all src all
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 localnet src 10.0.0.0/8	# RFC1918 possible internal network
acl localnet src 172.16.0.0/12	# RFC1918 possible internal network
acl localnet src 192.168.0.0/16	# RFC1918 possible internal network
acl localnet src fc00::/7       # RFC 4193 local private network range
acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines

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 70		# gopher
acl Safe_ports port 210		# wais
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 CONNECT method CONNECT

#
# Recommended minimum Access Permission configuration:
#
# Deny requests to certain unsafe ports
http_access deny !Safe_ports

# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports

# Only allow cachemgr access from localhost
http_access allow localhost manager
http_access deny manager

# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost

#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost

# And finally deny all other access to this proxy
http_access deny all

# Squid normally listens to port 3128
http_port 3128

# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/spool/squid 100 16 256

# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid

#
# Add any of your own refresh_pattern entries above these.
#
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

Setelah seting konfigurasi, jangan lupa untuk restart atau reload squid.

root@arenastreaming:/etc/squid# /etc/init.d/squid restart

kemudian bisa cek dengan command systemctl status squid.service

root@arenastreaming:/etc/squid# systemctl status squid.service
● squid.service - Squid Web Proxy Server
     Loaded: loaded (/lib/systemd/system/squid.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2024-03-15 21:41:39 UTC; 12min ago
       Docs: man:squid(8)
    Process: 43429 ExecStartPre=/usr/sbin/squid --foreground -z (code=exited, status=0/SUCCESS)
    Process: 43432 ExecStart=/usr/sbin/squid -sYC (code=exited, status=0/SUCCESS)
   Main PID: 43433 (squid)
      Tasks: 5 (limit: 2292)
     Memory: 21.4M
     CGroup: /system.slice/squid.service
             ├─43433 /usr/sbin/squid -sYC
             ├─43435 (squid-1) --kid squid-1 -sYC
             ├─43442 (logfile-daemon) /var/log/squid/access.log
             ├─43443 (pinger)
             └─43506 (basic_ncsa_auth) /etc/squid/passwords

Mar 15 21:41:39 arenastreaming squid[43435]: Set Current Directory to /var/spool/squid
Mar 15 21:41:39 arenastreaming squid[43435]: Finished loading MIME types and icons.
Mar 15 21:41:39 arenastreaming squid[43435]: HTCP Disabled.
Mar 15 21:41:39 arenastreaming squid[43435]: Pinger socket opened on FD 14
Mar 15 21:41:39 arenastreaming squid[43435]: Squid plugin modules loaded: 0
Mar 15 21:41:39 arenastreaming squid[43435]: Adaptation support is off.
Mar 15 21:41:39 arenastreaming squid[43435]: Accepting HTTP Socket connections at local=[::]:3128 remote=[::] FD 12 flags=9
Mar 15 21:41:40 arenastreaming squid[43435]: storeLateRelease: released 0 objects
Mar 15 21:46:35 arenastreaming squid[43435]: Starting new basicauthenticator helpers...
Mar 15 21:46:35 arenastreaming squid[43435]: helperOpenServers: Starting 1/20 'basic_ncsa_auth' processes

Karena squid sudah mendukung autentikasi, berikut untuk nambah, hapus user baru :

To create a new password file:

htpasswd -c -nbm /etc/squid/passwords username password

To add users:

htpasswd -nbm /etc/squid/passwords username password

To delete users:

htpasswd -D -nbm /etc/squid/passwords username password

Selamat Mencoba.

Share this Post
Mohammad Johan Rajabi

Saat ini bekerja di salah satu perusahaan Media Broadcasting nasional, di sela-sela kesibukan sebagai Chief Of IT, sering mengisi waktu dengan menulis seputar dunia IT dan Broadcast di beberapa website rajabi.me, alloperator.com dan arenastreaming.com

Leave a Reply

Your email address will not be published. Required fields are marked *

WP Radio
WP Radio
OFFLINE LIVE
WeCreativez WhatsApp Support
Our customer support team is here to answer your questions. Ask us anything!
👋 Hi, how can I help?