Setting Up Squid on Rocky Linux 8.10

2 Likes Comment

Have you ever needed to access the internet through a different IP address? Or wondered how much you should trust a free public proxy server with your internet traffic?

There are plenty of free proxy services available online. However, using a proxy operated by an unknown person or organization comes with an obvious question: Who is actually handling my traffic, and can I trust them?

A proxy server sits between your computer and the websites you visit. Depending on its configuration, it can forward your requests, provide a different public IP address, and give you more control over how your internet connections are routed.

This is why I decided to build my own private proxy server on a VPS.

Rather than relying on a random public proxy, I can operate the server myself, manage its users, choose the listening port, monitor its activity, and decide who is allowed to connect.

In this tutorial, I’ll walk you through the entire process using Squid Proxy on Rocky Linux 8.10. We’ll also configure username and password authentication and use a custom port so the proxy can coexist with an existing Nginx web server.

Let’s build one.

1. Why Would You Need Your Own Proxy Server?

Before installing anything, let’s look at why running a private proxy can be useful.

1.1. More control over your privacy

Whenever you access a website directly, that website normally sees your public IP address.

Your IP address can reveal information such as your approximate geographical location and internet service provider.

When you access a website through a proxy server, the website generally sees the proxy server’s public IP address instead of your original public IP.

For example:

  • Your computer: 203.0.113.10
  • Your VPS: 198.51.100.20
  • Destination website: example.com

Without a proxy:

Your Computer
     |
     v
example.com
     |
     v
Website sees: 203.0.113.10

With a proxy:

Your Computer
     |
     v
Your Private Proxy (VPS)
     |
     v
example.com
     |
     v
Website sees: 198.51.100.20

This gives you a different public-facing IP address when browsing through the proxy.

However, remember that a proxy is not a complete anonymity solution. Your VPS provider can still associate the server with your account, and websites may identify you through cookies, browser fingerprinting, or logged-in accounts.

1.2. Why not use free public proxies?

Free public proxies might look attractive because you don’t need to install or maintain anything.

But there are several disadvantages:

  • You don’t know who operates the server.
  • You cannot reliably verify how the operator handles your traffic.
  • Some public proxies log browsing activity.
  • Some may inject advertisements or manipulate unencrypted HTTP traffic.
  • Their availability and performance can be unpredictable.
  • You may share the same proxy with hundreds of unknown users.

A private proxy solves much of the trust problem because you control the VPS and its configuration.

You know where the server is hosted, who has access to it, and which accounts are authorized to use it.

Of course, the VPS provider still operates the underlying infrastructure, so a private proxy is not equivalent to having complete control over every part of the network.

1.3. An additional layer for network security

A private proxy can help manage access to the internet through a single controlled endpoint.

For example, you can:

  • Require authentication before accepting requests.
  • Restrict access to specific IP addresses.
  • Monitor connection activity.
  • Block requests to unwanted destination ports.
  • Disable caching when you don’t need it.
  • Revoke individual user accounts.

These controls make a private proxy easier to manage than an unknown public service.

There is one important distinction: a proxy does not automatically encrypt the connection between your computer and the proxy.

In our configuration, we’ll use HTTP proxy authentication. Basic authentication is not encrypted by itself, so credentials can be exposed if transmitted over an untrusted network.

For stronger protection, you should use a VPN or encrypted tunnel between your computer and your VPS.

1.4. Other practical use cases

A private proxy can also be useful for:

  • Testing websites from a different geographical location.
  • Checking how websites behave with different public IP addresses.
  • Managing multiple development environments.
  • Routing browser traffic through your own VPS.
  • Separating your normal internet connection from selected browsing activities.

For my purposes, I wanted something simple: a small private proxy that I could operate on an existing VPS without purchasing another server.

That’s where Squid comes in.

2. Why Choose Squid Proxy?

There are several proxy server solutions available, but Squid is a popular and mature option for Linux environments.

Some reasons to choose Squid include:

  • Open-source software.
  • Available through Rocky Linux package repositories.
  • Supports HTTP proxy requests.
  • Supports HTTPS destinations through the CONNECT method.
  • Built-in access control lists (ACLs).
  • Username and password authentication.
  • Detailed access logs.
  • Flexible configuration.
  • Relatively modest resource requirements for a small personal deployment.

Another advantage is that Squid can run alongside an existing web server.

For example, if your VPS already runs Nginx on ports 80 and 443, you can simply configure Squid to listen on another port.

We’ll use port 10143 in this tutorial.

3. Our Server Architecture

Here is the environment we’ll build:

ComponentConfiguration
Operating systemRocky Linux 8.10
Proxy softwareSquid 4.15
Existing web serverNginx
Proxy listening port10143
Proxy protocolHTTP
AuthenticationUsername and password
CachingDisabled
HTTPS websitesSupported through CONNECT

The services will operate independently:

                 Internet
                    |
          +---------+---------+
          |                   |
          v                   v
       Nginx                 Squid
       Port 80              Port 10143
       Port 443                 |
          |                     |
          v                     v
    Your Websites         Proxy Clients
                              |
                         Authentication
                              |
                              v
                        Destination Sites

No changes to your existing Nginx configuration should be necessary.

A note about terminology: HTTP proxy means the client connects to the proxy using the HTTP protocol. It does not mean the proxy can only access HTTP websites. We’ll enable HTTPS destinations using HTTP CONNECT.

4. Installing Squid on Rocky Linux 8.10

First, connect to your VPS using SSH.

Install Squid:

sudo dnf install squid -y

Check the installed version:

squid -v

Enable the service so it starts automatically after a reboot:

sudo systemctl enable --now squid

Check its status:

sudo systemctl status squid

At this stage, Squid is installed. Next, we’ll configure it to become a private authenticated proxy.

5. Creating Private Proxy Accounts

I don’t want everyone on the internet to be able to use my proxy.

Instead, each authorized user should have a username and password.

Squid supports several authentication mechanisms. For this tutorial, we’ll use Basic authentication with an NCSA password file.

Install the required utility:

sudo dnf install httpd-tools -y

Create your first proxy account:

sudo htpasswd -c /etc/squid/passwd proxyuser

You’ll be prompted to enter and confirm a password.

You can choose another username if you prefer.

Set the correct permissions:

sudo chown squid:squid /etc/squid/passwd
sudo chmod 640 /etc/squid/passwd

Adding more users

If you want to create another account, run:

sudo htpasswd /etc/squid/passwd anotheruser

You can also change an existing user’s password:

sudo htpasswd /etc/squid/passwd proxyuser

To remove an account, you can use:

sudo htpasswd -D /etc/squid/passwd anotheruser

Notice that we don’t use -c when adding or updating users. That option creates a new password file and can overwrite existing accounts.

6. Configuring Squid

Now comes the main configuration.

First, back up the original file:

sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.bak

Open the configuration:

sudo nano /etc/squid/squid.conf

Replace its contents with:

# ==========================================
# Private Squid HTTP Proxy
# Rocky Linux 8.10
# ==========================================

# Listen on custom port
http_port 10143

# Authentication configuration
auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd
auth_param basic realm PrivateProxy
auth_param basic credentialsttl 2 hours

# Authentication ACL
acl authenticated proxy_auth REQUIRED

# CONNECT method for HTTPS destinations
acl CONNECT method CONNECT

# Allowed destination ports
acl Safe_ports port 80
acl Safe_ports port 443
acl SSL_ports port 443

# Security rules
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports

# Require authentication
http_access allow authenticated

# Deny everyone else
http_access deny all

# Disable caching
cache deny all

# Hide Squid version
httpd_suppress_version_string on

# Access log
access_log /var/log/squid/access.log squid

Save the file.

Understanding the important settings

Let’s look at what we’ve configured.

Custom listening port

http_port 10143

Squid will listen on port 10143 instead of its default port 3128.

Authentication

auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd
acl authenticated proxy_auth REQUIRED

These lines enable username and password authentication.

Allowed destination ports

acl Safe_ports port 80
acl Safe_ports port 443
acl SSL_ports port 443

We allow regular HTTP traffic on port 80 and HTTPS tunneling on port 443.

Access control

http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow authenticated
http_access deny all

These rules ensure that requests to disallowed destination ports are rejected and authentication is required.

Disable caching

cache deny all

We don’t need Squid to store cached website content for this personal proxy deployment.

This keeps the configuration simple and avoids unnecessary cache storage.

7. Starting Squid and Checking the Configuration

Before restarting the service, validate the configuration:

sudo squid -k parse

If the configuration is correct, there should be no FATAL errors.

Restart Squid:

sudo systemctl restart squid

Check the service:

sudo systemctl status squid

Expected output:

Active: active (running)

Now check whether Squid is listening on port 10143:

sudo ss -lntp | grep 10143

You should see something similar to:

LISTEN 0 2048 *:10143 *:*

This confirms that the Squid process is listening for incoming connections.

8. Opening the Firewall Port

A running service does not necessarily mean that external computers can access it.

Your VPS may have multiple firewall layers:

  1. Rocky Linux firewalld.
  2. Your VPS provider’s network firewall.
  3. Additional network restrictions, if any.

First, check firewalld:

sudo firewall-cmd --state

If it returns running, open TCP port 10143:

sudo firewall-cmd --permanent --add-port=10143/tcp
sudo firewall-cmd --reload

Verify:

sudo firewall-cmd --list-ports

You should see:

10143/tcp

Restricting access to your own IP

For a more secure deployment, I recommend allowing connections only from your own public IP if it is static.

For example:

sudo firewall-cmd --permanent \
  --add-rich-rule='rule family="ipv4" source address="1.2.3.4/32" port port="10143" protocol="tcp" accept'

Replace 1.2.3.4 with your actual public IP.

If you previously opened the port to everyone, remove the general rule:

sudo firewall-cmd --permanent --remove-port=10143/tcp
sudo firewall-cmd --reload

Make sure the rich rule is added to the active firewall zone.

VPS provider firewall

Don’t forget the external firewall in your VPS provider’s control panel.

Add an inbound rule:

FieldValue
DirectionInbound
ProtocolTCP
Destination port10143
SourceYour public IP
ActionAllow

If you want to connect from changing IP addresses, you may need a broader source rule. In that case, use a strong security policy and consider VPN access.

9. Connecting Through Your Proxy

Now the interesting part: let’s actually use the proxy.

First, test it locally on your VPS.

HTTP test

curl -v -x http://127.0.0.1:10143 \
  -U proxyuser http://example.com

HTTPS test

curl -v -x http://127.0.0.1:10143 \
  -U proxyuser https://api.ipify.org

Curl will prompt for your password.

If successful, the HTTPS test should return your VPS public IP.

Test from Windows

Open Command Prompt or PowerShell.

Run:

curl.exe -x http://YOUR_VPS_IP:10143 -U proxyuser http://example.com

Then test HTTPS:

curl.exe -x http://YOUR_VPS_IP:10143 -U proxyuser https://api.ipify.org

Replace YOUR_VPS_IP with your server’s public IP.

If everything works, your browser traffic is now being forwarded through your VPS.

10. Using the Proxy in Your Browser

You can configure your browser or a proxy management application with these details:

SettingValue
Proxy typeHTTP
ServerYOUR_VPS_IP
Port10143
Usernameproxyuser
PasswordYour password

Your proxy endpoint is:

http://YOUR_VPS_IP:10143

Some applications also support URLs containing authentication credentials:

http://proxyuser:YOUR_PASSWORD@YOUR_VPS_IP:10143

Be careful with this format because credentials embedded in URLs may be stored in browser settings, logs, or application configuration files.

11. Cloudflare DNS: An Important Detail

If your domain is managed by Cloudflare, you might be tempted to create a subdomain such as:

proxy.example.com

However, Cloudflare’s standard orange-cloud HTTP proxy does not support arbitrary TCP proxy traffic on port 10143.

If you want to use a domain instead of an IP address:

  1. Create an A record pointing to your VPS.
  2. Set the record to DNS only (grey cloud).
  3. Connect using the domain and port 10143.

For example:

http://proxy.example.com:10143

Your existing website can continue using Cloudflare’s normal proxy service for Nginx.

12. Monitoring Proxy Activity

One benefit of running your own proxy is that you can inspect its activity.

Squid records requests in its access log.

View requests in real time:

sudo tail -f /var/log/squid/access.log

View the last 50 requests:

sudo tail -n 50 /var/log/squid/access.log

Check the service logs:

sudo journalctl -u squid -n 50 --no-pager

This is useful when you need to investigate connection failures, authentication problems, or unexpected traffic.

Remember that logs can contain IP addresses and browsing metadata, so protect them appropriately and establish a reasonable retention policy.

13. Troubleshooting Common Problems

Here are some problems you might encounter during installation.

ProblemPossible reason
Connection timed outFirewall or provider network restrictions
Connection refusedSquid is stopped or not listening
HTTP 407Authentication failed or credentials missing
Squid fails to startConfiguration syntax error
HTTPS connection failsCONNECT ACL or destination port restrictions
Proxy works locally but not remotelyFirewall, provider firewall, or routing issue

Useful diagnostic commands:

# Validate Squid configuration
sudo squid -k parse

# Check service status
sudo systemctl status squid

# Check listening port
sudo ss -lntp | grep 10143

# Check firewalld
sudo firewall-cmd --list-all

# Monitor proxy activity
sudo tail -f /var/log/squid/access.log

# Check system logs
sudo journalctl -u squid -n 50 --no-pager

If the proxy works locally but not from your computer, investigate the firewall before changing the Squid configuration.

14. Important Security Considerations

Before putting your proxy into regular use, understand these limitations.

Basic authentication is not encryption

Our configuration uses HTTP Basic authentication.

Although the password is stored as a hash on the server, the credentials are transmitted using Base64 encoding, which is not encryption.

Anyone capable of intercepting the client-to-proxy connection on an untrusted network may be able to recover the credentials.

For better protection, consider:

  • Connecting to the VPS through WireGuard or another VPN.
  • Using an encrypted SSH tunnel.
  • Configuring TLS protection for the proxy connection.
  • Restricting access by client IP address.

HTTPS CONNECT does not mean the proxy connection is encrypted

When accessing an HTTPS website, Squid creates a CONNECT tunnel. The HTTPS traffic between your browser and the destination website remains protected by TLS.

However, the connection from your computer to Squid is still an ordinary HTTP connection.

The proxy operator can generally see destination IP addresses and domain information, even though the encrypted HTTPS page contents are not normally readable.

Avoid operating an open proxy

An open proxy can be abused by strangers for spam, scraping, attacks, or other unwanted activity.

Always require authentication, use strong credentials, and restrict access where possible.

15. Useful Squid Management Commands

For everyday maintenance, here are the commands worth keeping:

TaskCommand
Start Squidsudo systemctl start squid
Stop Squidsudo systemctl stop squid
Restart Squidsudo systemctl restart squid
Check statussudo systemctl status squid
Validate configurationsudo squid -k parse
Reload configurationsudo squid -k reconfigure
View access logssudo tail -f /var/log/squid/access.log
Check listening portsudo ss -lntp | grep 10143

Conclusion: Your Own Proxy, Your Own Rules

Building a private proxy server doesn’t have to be complicated.

With a small Linux VPS and Squid, you can create a personal proxy endpoint, authenticate individual users, control incoming connections, and monitor network activity.

For this setup, we used Rocky Linux 8.10, Squid 4.15, and port 10143. We also kept the existing Nginx web server running without changing its configuration.

The biggest advantage isn’t simply having another IP address. It’s having greater control over the service you use to route your internet traffic.

Instead of depending on an unknown public proxy operator, you operate your own infrastructure and decide who gets access.

My final recommendation: If you plan to use this proxy regularly, especially when connecting from public Wi-Fi or other untrusted networks, add an encrypted VPN or tunnel. A private proxy provides control, but encryption is what protects the connection itself.

You might like

Avatar

About the Author: Lazy Angler

Leave a Reply

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