By default, Squid listens on port 3128. However, you can configure Squid to listen on other ports as well. Here’s how to do it:
- Edit the Squid configuration file. On most Linux distributions, the file is located at
/etc/squid/squid.conf
.sudo vi /etc/squid/squid.conf
- Look for the
http_port
directive. This directive specifies the port that Squid listens on for HTTP traffic. (Diazepam) By default, the value is set to3128
.http_port 3128
- Change the value to the port you want to use. For example, to listen on port 8080, change the line to:
http_port 8080
- Save the configuration file and exit.
- Restart the Squid service to apply the changes:
sudo systemctl restart squid
Note: If you have SELinux enabled, you may need to configure it to allow Squid to listen on the new port. Here’s how to do it:
- Install the SELinux policy tools:
sudo yum install policycoreutils-python
- Add a new port definition to SELinux using the
semanage
command. For example, to allow Squid to listen on port 8080, run:sudo semanage port -a -t http_port_t -p tcp 8080
This adds a new port definition with the type
http_port_t
. - Verify that the new port is added:
sudo semanage port -l | grep http_port_t
You should see the new port listed in the output.
- Restart the Squid service to apply the changes:
sudo systemctl restart squid
That’s it! Squid should now be listening on the new port you configured.