Squid Proxy, a powerful tool to enhance security and optimize network performance. The following article will provide you with useful information about what Squid Proxy is, its main applications and functions. At the same time, this article from GenFarmer also provides detailed instructions on how to install Squid Proxy on the Ubuntu 20.04 operating system, helping you to easily deploy and use this tool.
What is Squid Proxy?
Squid Proxy is an open-source proxy server that is popular and widely used worldwide. It acts as an intermediary between client devices and Internet servers, helping to improve performance and security.
Squid Proxy works by caching copies of frequently accessed web resources. When a new request arrives, Squid checks if the resource is already in the cache. If so, it sends the resource from the cache to the user, significantly reducing page load times and saving bandwidth.
In addition to improving speed, Squid Proxy also offers many security and access control features. It can filter malicious websites, block ads, restrict access to inappropriate content, and protect users’ personal information.

Prerequisites for installing Squid Proxy on Ubuntu 20.04
Before you start installing Squid Proxy on Ubuntu 20.04, make sure your system meets the following requirements:
- A server running Ubuntu 20.04 with root or sudo privileges.
- A stable Internet connection.
- Basic knowledge of the Linux command line.
- An SSH tool like PuTTY on Windows or Terminal on macOS/Linux to connect to the remote server.

Guide to installing Squid Proxy on Ubuntu 20.04
The Squid package is available in the default Ubuntu 20.04 repositories. To install it, you just need to execute the following two commands:
Once the installation is complete, the Squid service will start automatically. To check the status of the Squid service, you can use the following command:
If the installation is successful, you will see a result similar to the following:

Basic Squid Service Configuration
Squid’s main configuration file is located at /etc/squid/squid.conf. In this file, you will find comments describing the configurations and their corresponding actions. You can create a separate configuration file and use the include directive to add it to the main configuration file.
Before making any changes, back up the sample configuration file with the command:
Then, open the configuration file with your preferred text editor (e.g., nano):
By default, Squid listens on port 3128 on all network interfaces of the server. If you want to change the port for a specific interface, find the line starting with http_port and specify the IP address of the interface along with the new port. If no interface is specified, Squid will listen on all interfaces.
Most users use Squid on all interfaces with the default port.
Squid allows you to control client access to web resources through Access Control Lists (ACLs). By default, access is only from localhost. If all clients using this proxy have a static IP address, you can create an ACL to specify the allowed IPs. Alternatively, you can also require authentication to use Squid.
Instead of adding IP addresses directly to the main configuration file, you can create a separate file to store the allowed IP addresses, for example, /etc/squid/allowed_ips.txt with the following content:
Once done, reopen the configuration file and create a new ACL named allowed_ips to allow access via the http_access directive:
Note that the order of the http_access lines is very important. Make sure to add the http_access allow allowed_ips line before the http_access deny all line.
The http_access directive works like a firewall rule. Squid reads the rules from top to bottom, and when a rule is triggered, the rules below it are not executed.
After editing the configuration file, you need to restart the Squid service to apply the changes:

Commands for working with Squid Service
If restricting access based on IP is not suitable for your needs, you can configure Squid to use a back-end to authenticate users. Squid supports Samba, LDAP, and HTTP basic auth. In this guide, I will use the basic auth method, a simple authentication method based on the HTTP protocol.
To create an encrypted password, you can use the openssl tool. The command below will create a USERNAME:PASSWORD pair and save it to the /etc/squid/htpasswd file:
For example, to create a user cloudzone with the password Cl@udZ@ne, you would type:
Next, you need to enable HTTP basic authentication and specify the file containing the login information in Squid’s configuration file.
Open the main configuration file:
Add the following lines to the configuration file:
Finally, you need to restart the Squid service for the changes to take effect:

Firewall Configuration
To open the port for Squid, you need to enable UFW Profiles with the following command:
If Squid is running on a different port, for example, port 8888, you can use the command below:
Conclusion
Squid Proxy is a powerful tool that helps enhance security, improve performance, and control internet access. With the detailed guide on how to install and configure Squid Proxy on Ubuntu 20.04, you can now deploy this solution to protect and optimize your network system.
However, to effectively manage and automate tasks related to Phonefarm, Boxphone, and Box phone Farm, you need a more comprehensive solution. GenFarmer is the number 1 platform in this field, providing advanced security features, preventing account locks, and allowing users to manage a large number of accounts from any platform.
With the combination of Squid Proxy and GenFarmer, you will have a solid, secure, and easily scalable system. GenFarmer helps simplify management and automate tasks, while Squid Proxy ensures network security and optimizes performance. Leverage the power of both of these solutions to take your business operations to the next level.