Proxy server (squid) on ubuntu

Complete How-To

You can find a complete how-to here:

Squid in short


sudo apt install squid


# backup original config
sudo cp -v /etc/squid/squid.conf{,.factory}

# open to edit
sudo nano /etc/squid/squid.conf

Add new allow rule to the config right before the first deny rule (http_access deny !Safe_ports ):

# Allows all 
http_access allow Safe_ports

http_access deny !Safe_ports

Force hiding clients real ip:

forwarded_for delete
via off
forwarded_for off
follow_x_forwarded_for deny all
request_header_access X-Forwarded-For deny all
forwarded_for delete

Check configuration:

sudo /usr/sbin/squid -k check
echo $?
sudo /usr/sbin/squid -k parse

Start/stop/restart Squid

Enable on boot time:

sudo systemctl enable squid.service


# start
sudo systemctl start squid.service
# stop
sudo systemctl stop squid.service
# restart
sudo systemctl restart squid.service

Reload config:

sudo systemctl reload squid.service


# status
sudo systemctl status squid.service
# logs
sudo journalctl -u squid.service

Open firewall (ufw) for specific IP address

ufw allow from <ip> to any port 3128

# to delete
ufw status numbered
ufw delete <number>

Configure Browser

Port: 3128

Set HTTP Proxy (also for FTP and HTTPS)

Set SOCKS v5 Host

Leave a comment

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