Before we start with installing and configuring Squid, let’s update all the system software to the latest version available:
sudo apt-get update && sudo apt-get -y upgrade
The update should take few moments. Once it is done, you are ready to proceed with the other steps of this tutorial. Since Squid is available in the Ubuntu repositories, the installation of Squid proxy server on an Ubuntu VPS is pretty straightforward. To install it on your server you need to run the following command:
sudo apt-get install squid
The main configuration file for Squid is /etc/squid3/squid.conf. Before making any changes to the original Squid configuration, please make a copy of the original configuration file. You can do that using the following command:
sudo cp /etc/squid3/squid.conf /etc/squid3/squid.conf.orig
To edit the configuration file, you can use your favorite software for text editing. We will use nano.
sudo nano /etc/squid3/squid.conf
The first thing you may like to change is the Squid listening port. By default, Squid is listening on port 3128. To change the default listening port you need to edit the http_port directive. For example, if you like to set 8888 as Squid listening port, you should edit the directive to look like the directive below:
By default, the HTTP proxy server will not allow access to anybody. To allow access to the HTTP proxy server from all IP addresses, you need to edit the http_access directive and make it look like the following:
http_access allow all
Another directive you may like to change is the visible_hostname. This directive allows you to set up a specific hostname for your Squid HTTP proxy server. Feel free to use any hostname you like.
Once you make the necessary changes to the Squid configuration file, you can save the file and restart the Squid service so the changes can take effect. To restart Squid you can use the following command:
sudo service squid3 restart
To test if the configuration of Squid HTTP proxy server is working or not, you need to manually change your web browser’s proxy settings and enter your server’s IP address and port number.
If you experience any problems, you can check the access.log for more information.
sudo tail -f /var/log/squid3/access.log
More information and configuration instructions about Squid HTTP proxy server you can find at the official web site. It is available at http://www.squid-cache.org/.
Of course you don’t have to do any of this if you use one of our Linux VPS hosting services, in which case you can simply ask our expert Linux admins to install Squid proxy server for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.