Use Squid as HTTP / HTTPS / SSH Proxy

Written by Kees van Dieren

Guide to install Squid proxy server to proxy HTTP, HTTPS and SSH.

When is it useful

Sometimes you need to serve the internet as if you are on another location. Some examples:

  • Test CDN solutions
  • View iOS / Android app store presence from various locations
  • View localized Adwords / Facebook ads
  • Use services that are available only in some territories
  • Use SSH on a LAN that does not have outbound port 22 open

Solutions

Possible solutions to get a proxy:

  • Use premium proxy service such as Smartproxy.
  • Create simple server with Proxy server installed.

We found the latter solution the most affordable and flexible. And it is easy as well.

Configure Squid proxy on Ubuntu for HTTP, HTTPS and SSH

  1. create an Ubuntu or Debian Virtual server
  2. install the Squid proxy server: apt-get install squid
  3. configure squid (see chapter below: configure Squid)
  4. restart squid (service squid restart)

Configure Squid

Open the configuration file in an editor: vi /etc/squid/squid.conf

Allow your client IP’s to use proxy

Locate INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS and add the following lines below:

acl holiday_location src 82.236.191.91
http_access allow holiday_location

Allow SSH port (22) to be proxied

Locate acl SSL_ports port 443

Add above the following line:

acl SSL_ports port 22   # ssh

Locate acl Safe_ports port 21

Add the following line below:

acl Safe_ports port 22          # ssh

Restart Squid

Don’t forget to restart squid using command: service squid restart

Configure SSH clients to connect via proxy

Install Corkscrew

Next, in ~/.ssh/config, add the following block:

host * 
    ProxyCommand corkscrew proxy-hostname-or-ip-address 8080 %h %p

Now connect to SSH servers as usual to connect via a proxy.

Alternative when configuration and installing Squid on Linux failed

When installing Squid on Linux doesn’t succeed, try paid service Smartproxy.

Posted in:  Proxy  ASO 

Kees van Dieren, CEO

We've years of experience helping startups and scale-ups to work more efficient by creating apps that are fit their needs.

Let’s talk. We look forward to exploring the opportunity to help your company too.

Go ahead and send us a message. We look forward to exploring the opportunity to help you too.