Use Squid as HTTP / HTTPS / SSH Proxy
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 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.
Possible solutions to get a proxy:
- Use premium proxy service (subscription fees from $ 12.00 - $ 50.00 p/m)
- 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
- create an Ubuntu or Debian Virtual server.
- install the Squid proxy server:
apt-get install squid
- configure squid (see chapter below: configure Squid)
- restart squid (
service squid restart)
Open the configuration file in an editor:
Allow your client IP’s to use proxy
INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS and add the following lines below:
acl holiday_location src 18.104.22.168 http_access allow holiday_location
Allow SSH port (22) to be proxied
acl SSL_ports port 443
Add above the following line:
acl SSL_ports port 22 # ssh
acl Safe_ports port 21
Add the following line below:
acl Safe_ports port 22 # ssh
Don’t forget to restart squid using command:
service squid restart
Configure SSH clients to connect via proxy
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.