How to Install Squid HTTP Proxy Server in Ubuntu (Digital Ocean)

Creating your own HTTP proxy server that you can use to surf the internet using an IP address from a server is one of the quickest ways to hide your IP address or access region-locked websites.

In Digital Ocean, for example, a website where you can setup a server. You can make your own proxy server for just $5 a month. This guide is for all newbie and will give you a step-by-step guide on creating your own proxy server via SSH command.

The version of Ubuntu we use on this guide is 18.04.3. Let’s say you already have a server and already connected to it using SSH, follow the step below.

Installing Squid

To install squid, we need to update first our server. After that, install the squid3.

apt-get update
apt-get install squid3


Once the squid is installed, we can now configure it to enable the HTTP proxy. Open squid.conf configuration file at /etc/squid directory.

vim /etc/squid/squid.conf

Add the following configuration. Make sure to change IP_ADDRESS_OF_YOUR_SERVER with your Server’s IP Adress and YOUR_NAME_SERVER with your Server’s Name.

acl url1 url_regex -i
acl url2 url_regex -i localhost
acl url3 url_regex -i IP_ADDRESS_OF_YOUR_SERVER

http_access allow url1
http_access allow url2
http_access allow url3
http_access allow all #Remove this if using a password

http_port 8080
http_port 80
http_port 3128
visible_hostname YOUR_NAME_SERVER    

forwarded_for off
via off         

Everything is good and you can now restart your server to start using it.

service squid restart

Adding Authentication

There are some cases that other people might sneak to your IP address and use your proxy server without your knowledge, this leads to server down and poor connection. In this case, you need to protect your http proxy server with a password. To do that, you need to tweak some code in squid.conf at the /etc/squid directory.

vim /etc/squid/squid.conf 

Add the following at the bottom.

auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwd
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
http_access allow authenticated

Also, delete the http_access allow all at the squid.conf. Since we are now restricting access without a password.

Once done, we need to install htpasswd to generate a password.

apt install apache2-utils
htpasswd -c /etc/squid/passwd YOUR_USERNAME

It will prompt for a password, type your password and reconfirm it by typing again.

Once done, you can now restart your server.

service squid restart

That’s it! You’ve just done creating your secured http proxy server.

Leave a Comment

trabzon escort yalova escort Samsun escort izmit escort nazilli escort