How to Configure a Squid Proxy to Listen on Multiple Ports

Cpanel/Whm License $3/mo Plesk License $10/mo Cloudlinux License $5/mo

Squid via Command Line 101: Basic Installation and Configuration
I. How to Install Squid (Caching / Proxy) on Ubuntu 12.04 LTS, Ubuntu 14.04 LTS, CentOS 7, Fedora 20, or Fedora 21
II. How to Change the Default Listening Port for a Squid Proxy
III. How to Configure a Squid Proxy to Listen on Multiple Ports

Squid is a caching and forwarding web proxy. It is most often used in conjunction with a traditional LAMP stack (Linux, Apache, MySQL, PHP), and can be used to filter traffic on HTTP, FTP, and HTTPS, and increase the speed (thus lower the response time) for a web server via caching.

Pre-Flight Check
  • These instructions are intended specifically for configuring a Squid Proxy to listen on multiple ports.
  • In this case I’ll be working from a sxi.io Web Core Managed CentOS 7 server, and I’ll be logged in as root.

Step #1: Check the Current Port

By default, Squid launches a session listening on port 3128.

Running the command:

netstat -plant

Should show something similar to:

Proto  Recv-Q  Send-Q  Local Address  Foreign Address  State  PID/Program name
tcp6   0       0       :::3128        :::*             LISTEN 6261/(squid-1)

Where :::3128 is the port on which Squid is listening.

Step #2: Find the Configuration File
Note: If you found the location of the configure file in the last article in this series, then you can skip to Step #3.

Configuration file locations may vary. The config file should be called squid.conf. To find the config file use the following command:

locate squid.conf

You should receive a result similar to:

/etc/squid/squid.conf

Step #3: Configure Multiple Listening Ports

For a refresher on editing files with vim see: New User Tutorial: Overview of the Vim Text Editor

Now, let’s edit the file found in the previous step:

vim /etc/squid/squid.conf

Look for a section of the configuration file similar to:

# Squid normally listens to port 3128
http_port 3128

Each port number on which you’d like Squid to listen requires a separate line in the config file.

For example: to use port 1337 and 1338 edit the file to include:

http_port 1337
http_port 1338

Exit and save the file, and then restart Squid:

systemctl restart squid

Now running the command:

netstat -plant

Should show something similar to:

Proto  Recv-Q  Send-Q  Local Address  Foreign Address  State  PID/Program name
tcp6   0       0       :::1337        :::*             LISTEN 6261/(squid-1)
tcp6   0       0       :::1338        :::*             LISTEN 6261/(squid-1)

Where :::1337 and :::1338 are the ports on which Squid is listening.

Related posts

Florincoin – The 2013 Altcoin You Don’t Remember – Is Attracting Real Users

SXI ADMIN

Precious Metals Dealer JM Bullion Accepts Bitcoin

SXI ADMIN

How to Start and Enable Firewalld on Fedora 20

SXI ADMIN

Explains: echo Command (echo $”string”) Double-quoted String Preceded By a Dollar Sign

SXI ADMIN

Amber Baldet Leaving JPMorgan Blockchain Team to Start New Venture

SXI ADMIN

Linux / UNIX Find Out What Program / Service is Listening on a Specific TCP Port

SXI ADMIN

BitPay Cuts ‘Free and Unlimited’ Bitcoin Processing for New Merchants

SXI ADMIN

The Collapse of QuadrigaCX: What We Know (And What We Don’t)

SXI ADMIN

The Risks of Segregated Witness: Possible Problems Under US Contract Law

SXI ADMIN

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More