How to change Port of Squid Proxy Server

Squid proxy server runs on port 3128 by default. Changing squid proxy server port to a non-standard port is a good idea as it will protect your proxy server from abusers and hackers.

Method 1

You can use the sed command to replace the port number

In the above command, replace NEW_PORT_HERE with the port number you need.

For example, to run squid proxy on port 5555, run

Now restart Squid Proxy server

If you have a firewall, you will need to open the port in the firewall.

Method 2: Manual Configuration Change

Edit Squid configuration file with vi or nano editor.

In the file, find http_port, it should look like

Change 3128 to whatever port number you like. Save and exit the editor.

Restart Squid Proxy server with the command

Open Port in firewall

If you have a firewall, you need to open the port in the firewall.

CentOS/AlmaLinux/RHEL

If you are using firewalld, you can use the command

Replace 8000 with your squid prox port.

Back to Squid Proxy Installer

Need help with Linux Server or WordPress? We can help!

Leave a Reply

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