Web proxies have been around for quite some time now and have been used by millions of users around the globe. They have a wide range of purposes, most popular being online anonymity, but there are other ways you can take advantage of web proxies. Here are some ideas:
- Online anonymity
- Improve online security
- Improve loading times
- Block malicious traffic
- Log your online activity
- To circumvent regional restrictions
- In some cases can reduce bandwidth usage
How Proxy Server Works
The proxy server is a computer that is used as an intermediary between the client and other servers from which the client may request resources. A simple example of this is when a client makes online requests (for example want to open a web page), he connects first to the proxy server.
The proxy server then checks its local disk cache and if the data can be found in there, it will return the data to the client, if not cached, it will make the request in the client’s behalf using the proxy IP address (different from the clients) and then return the data to the client. The proxy server will try to cache the new data and will use it for future requests made to the same server.
What is Squid Proxy
Squid is a web proxy that is used by wide range of organizations. It is often used as a caching proxy and improving response times and reducing bandwidth usage.
Lets Get Installing
Note : This guide is for CentOS
yum -y install squid httpd-tools
cp /etc/squid/squid.conf /etc/squid/squid.conf.bak
touch /etc/squid/blacklist.acl
This command will confirm its installed an stopped with the inactive (dead)
systemctl status squid
Now we need to ensure the service starts normally before updating more configuration, so first enable it then start it with the commands below and then check the status:
systemctl enable squid
systemctl start squid
systemctl status squid
Here you can Squid is online and running, this will be on the default port of TCP:3129 if you need a different port that is covered later on in the guide
nano /etc/squid/squid.conf
The default configuration file for Squid as it comes out of the box, as you can see it allows lots of services and network you do not need, so after some tweaking this is my final file:
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 443 # https
acl CONNECT method CONNECT
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access allow localnet
http_access allow localhost
http_access deny all
cache_mem 2500 MB
cache_mgr cache@a6n.co.uk
coredump_dir /var/spool/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
Once you have made your changes, all you need to do is restart Squid
systemctl restart squid
sh -c "$(curl -sL https://nextdns.io/install)"
This will look like this:
Then you will need to set it up as below, which will follow this process: