Académique Documents
Professionnel Documents
Culture Documents
04 LTS – LinuxWays
UBUNTU
Chercher
Top 5 des
logiciels gratuits
de diagramme de
Gantt
Top 4 des
logiciels RH
gratuits et open
source
Top 8 des
Dans notre article précédent Comment installer le serveur proxy Squid sur Linux , nous vous systèmes de
avons fourni l'introduction de base du serveur Squid et son installation dans le système Linux. gestion de
Dans cet article, nous allons suivre pour configurer le serveur proxy Squid. Nous aborderons les documents
sujets suivants : gratuits et open source
Configuration du serveur proxy Squid sur Linux Jaime sur Comment installer
Microsoft Teams sur Ubuntu
Le fichier de configuration du serveur proxy Squid se trouve dans /etc/squid/squid.conf .list. 20.04 LTS
Ce fichier contient des directives par lesquelles le serveur proxy Squid est configuré.
Ummara sur Comment
changer le type de police, la
Configurer Squid pour écouter sur un autre port taille et la couleur du
Par défaut, le serveur proxy Squid écoute sur le port 3128 le trafic provenant des machines terminal Ubuntu 20.04 LTS
clientes. Cependant, vous pouvez le configurer pour écouter sur un port différent du port par
Samreena Aslam sur
défaut à l'aide de la directive http_port .
Comment changer le type de
police, la taille et la couleur
Modifiez la configuration de calmar à l'aide de la commande ci-dessous :
du terminal Ubuntu 20.04
LTS
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 1/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
http_port 3128
Remplacez maintenant 3128 par le numéro de port que vous souhaitez que le serveur proxy
Squid écoute, disons 3155 :
http_port 3155
Maintenant, redémarrez le service du serveur proxy squid pour que les modifications prennent
effet :
visible_hostname <host_name>
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 2/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
Par exemple, pour définir « linuxways » comme nom d'hôte du serveur proxy Squid, l'entrée
serait :
visible_hostname linux?ways
Once you are done with the configurations, save and exit the configuration file.
Now, restart the Squid proxy service for the configuration changes to take effect.
In case the Squid client receive any error page, he will see the hostname listed at the bottom of
the webpage.
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 3/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
Then search for the following entry in the configuration file and replace 256 by the amount to
set for the cache memory size.
cache_mem 256 MB
For instance, to set the cache size to 512 MB, the entry would be changed to:
cache_mem 512 MB
Once you are done with the configurations, save and exit the configuration file.
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 4/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
For instance, to set 8.8.4.4 as name servers, the entry would be:
Once you are done with the configurations, save and exit the file.
To match traffic coming from LAN 192.168.5.0/24, we will need to create an ACL rule in the
Squid configuration file:
Once the ACL is defined, you can use the http_access directive to allow/deny access. Here is
the syntax for the http_access directive:
Where NAME identifies the traffic which you want to allow/deny access.
To allow the traffic identified in the ACL, you will need to add the following http_access
directive in the Squid configuration file:
Note: To search for an entry in the Nano editor, Press Ctrl+w, and type the expression you want
to search. In the case of the above example, press Ctr+w and type acl localnet src as shown in
the following screenshot.
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 6/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
3. Here, you will see the number of entries for different IP address ranges. Here, add an entry
for your network as follows:
For instance, your local network runs on the 192.168.72.0/24 subnet. In this case, the entry
would be:
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 7/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
4. Now using the http_access directive, allow the sources identified by the acl named localnet
defined above. The http_access directive is already defined in the configured, you only need to
find and uncomment it.
Search for the entry #http_access allow localnet and then uncomment it by removing the #
character.
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 8/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
Now list the sites you want to deny access to and then save and exit the file.
.msn.com
.yahoo.com
.bbc.com
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 9/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
Then edit the squid configuration file using the below command:
Now create an ACL rule for the denied websites and mention the file containing the list of
denied websites.
The ACL rule denied_sites will match all requests destined for the websites listed in the
“/etc/squid/deniedsites.acl” file.
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 10/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
Now you will need to add the http_access directive to deny the websites identified by the
above ACL rule named denied_sites. Add the below line in the Squid configuration file:
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 11/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
Once you are done with the configurations, save and exit the file.
1. First, we will have to install Apache2-utils. Use the following command to do so:
$ touch /etc/squid/passwd
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 12/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 13/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
Type a password and then confirm by re-entering it. Now the user and its encrypted password
will be saved to the /etc/squid/passwd file.
Once you are done with the configurations, save and exit the
configuration file.
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 14/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
1. Open a web browser in your system. Here we will use the Firefox browser.
2. Go to upper right corner of your browser and click three horizontal bar icon. Then click
Options.
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 15/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
3. Then in the search bar, type network. When the search result appears, click Settings as can
be seen in the below screenshot.
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 16/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
4. Select the Manual proxy configuration option button. Then type the IP address of the Squid
proxy server in the HTTP Proxy field and port number in the Port field. Also, check the Also use
this proxy for FTP and HTTPS checkbox. Then click OK.
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 17/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
Now in order to check if the Squid server is working, try accessing any website in your browser.
You will see an authentication dialog. Enter the squid username and password that you have
created before and click OK.
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 18/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
Now try accessing another website that you have blocked using the access list. The browser will
show the following page saying ‘The proxy server is refusing connections”.
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 19/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
That is all there is to it! In this article, you have learned how to configure Squid proxy server on
a Linux system. We have just discussed the basic configurations. There is a lot more you can do
with Squid proxy server. Visit official documentation for more information.
Ummara Mushtaq
Ummara Mushtaq is a Telecommunication engineer with two years of experience in
server support and networking. She writes technical articles based on Linux system
administration for LinuxWays.
Similar Posts
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 20/21
21/09/2021 13:00 How to configure Squid Proxy Server on Ubuntu 20.04 LTS – LinuxWays
https://linuxways.net/ubuntu/how-to-configure-squid-proxy-server-on-ubuntu-20-04-lts/ 21/21