Skip to content

Running your own proxy: Squid, nginx and when to buy instead

By the ProxyOnly team · 16 Nov 2026 · 5 min read

How to run your own proxy server with Squid, why nginx is the wrong tool for a forward proxy, the safety rules that matter, and when buying is the better deal.

Running your own proxy server is easier than most people expect. A small cloud server and one well-known program will do it in an afternoon. What you get is also smaller than most people expect: one address, in one place, on a hosting company's network. This guide covers how to do it with Squid, why nginx is usually the wrong tool, what keeps a home-made proxy from becoming everyone's proxy, and when buying is the better deal.

We sell proxies, so we have a view on the last question. We have tried to make the case for running your own fairly, because for some jobs it is the right answer.

What you get when you run your own

  • One address per server. The address belongs to your hosting company's network, so websites see a datacenter address, the same kind as a datacenter proxy.
  • One location: wherever the server is.
  • Full control: you decide what is logged, who can connect and how it is configured.
  • Full responsibility: abuse sent through your proxy comes from your address, and complaints go to your hosting company and then to you.

That is a good fit for a fixed address to give a partner's allowlist, a privacy hop you trust because you run it, a cache or filter for an office, or learning how proxies work. It is a poor fit for many addresses, many countries, household addresses or rotation.

Squid: the standard choice

Squid is a caching forward proxy that has been developed for decades, is packaged for most Linux distributions and is documented in detail. Its documentation says it normally listens on port 3128.

Its defaults are cautious. The comments in Squid's recommended access rules explain that the default configuration only allows requests from the same machine, because a more permissive installation could expose other services to anyone. The default rules also deny requests to unsafe ports and deny CONNECT tunnels to anything other than secure ports. Keep those rules, and add your own at the line in the configuration file that says to insert your own rules.

To let people in with a username and password, the Squid wiki gives this example, which uses a password file managed with the htpasswd tool:

auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwords
auth_param basic children 5
auth_param basic credentialsttl 1 minute
acl auth proxy_auth REQUIRED
http_access deny !auth
http_access allow auth
http_access deny all

The helper's path varies between distributions, so check where your package installed basic_ncsa_auth. We did not install Squid for this article, so this comes from its wiki and documentation rather than from a run on our machine.

Two privacy settings matter for a proxy that forwards your own traffic. By default Squid adds your client's address in an X-Forwarded-For header, and its documentation lists forwarded_for delete to remove the header entirely. It also adds a Via header by default, and turning that off needs a Squid built with HTTP violations enabled. Transparent, anonymous and elite proxies explains why these headers matter and how to test what your proxy sends.

nginx: a reverse proxy, not a forward one

nginx is excellent at sitting in front of your own websites, which is a reverse proxy. A forward proxy for HTTPS needs the CONNECT method, and nginx does not handle it out of the box. The usual add-on, ngx_http_proxy_connect_module, describes itself as adding support for the CONNECT method, and its install steps patch the nginx source and compile nginx with the module. That is a lot of upkeep for something Squid does by default.

If you came to nginx because of the popular "Nginx Proxy Manager" project, that is a tool for managing reverse proxies for your own sites, not a way to browse through a proxy. Forward proxy vs reverse proxy explains the difference.

Smaller alternatives

  • Tinyproxy is a small HTTP and HTTPS proxy. Its sample configuration uses port 8888, a BasicAuth line adds a username and password, and a ConnectPort setting limits which ports tunnels may reach.
  • Dante is a free SOCKS server from Inferno Nettverk, for when you need SOCKS instead of HTTP.
  • mitmproxy, Charles and similar tools are debugging proxies for inspecting your own traffic. They are not meant to serve other users.

Rules that keep it yours

  • Require a login, or allow only known client addresses. A proxy that accepts anyone is an open proxy, and open proxies end up on public lists. The free proxies article covers what happens to the people who use them.
  • Restrict the proxy port in the server's firewall to the addresses that should use it.
  • Keep the default rules that block unsafe ports and limit tunnels to port 443.
  • Read your hosting company's acceptable use policy. Some limit running proxies or VPNs, and all of them act on abuse reports.
  • Decide what you log and for how long, and keep the software updated.
  • Test it from outside: a request through the proxy should show the server's address, and a request without the login should get a 407.

When buying is the better deal

Running your own wins when you need one or two fixed addresses, full control, and you are comfortable maintaining a server.

Buying wins when you need any of these:

  • Many addresses, because each extra address on your own setup is another server or another IP to rent and manage.
  • Many countries, because each country means a server in that country.
  • Household or mobile addresses, which you cannot create on a hosting company's network.
  • Rotation across a pool, which needs a pool.
  • No maintenance, abuse handling or patching on your side.

For scale, our pricing page on 16 November 2026 listed dedicated datacenter IPv4 addresses from US$0.70 per IP for a week, in 61 countries, and residential traffic from US$7.00 per GB. Compare that with the server, the address and your own time, not with the server alone.

A middle path: Squid in front of a bought proxy

Some teams run Squid in their own network and point it at a bought proxy as its upstream. Their applications talk to one internal proxy, while the exit addresses come from the provider. Squid calls this a parent or peer proxy, and our Squid setup guide shows the configuration with a proxy from your order.

Try it yourself

Create an account, add funds from US$1 and order a proxy in the country you need.

Keep reading