How to Setup Proxy Server on Ubuntu (Linux)

In order to install squid proxy server on Ubuntu, open terminal and type

sudo apt-get install squid

Now, lets open squid configure file with an text-editor  (I am using scite text editor)

sudo scite /etc/squid/squid.conf

Search in configuration file and find which port is used by squid. 

http_port 3128

If you like you can change the port.

Let's define IP or IPs that can use this proxy server.

acl my_network src 192.168.2.11

Then let's allow the defined my_network to be able to use the proxy server

http_access allow our_networks

Let's save the configuration file.. And restarting squid

sudo /etc/init.d/squid restart

That's it!

How to Use Proxy Server in Firefox

Now, let's connect to the proxy from a client, for example from Firefox.

In Firefox follow Preferences | Advanced | Network | Settings and open "Connection Settings" window.

Select "Manual Proxy Configuration" and set the IP of the computer that squid installed on. Then set the port as defined in squid configuration file. (In this example is 3128)

Now you can browse on the internet through proxy server.

Extra Options For Squid

Authentication

To set a username/password authantication, edit the squid.conf file... Sample configuration: 

auth_param basic program /usr/lib64/squid/ncsa_auth /etc/squid/passwd

auth_param basic children 5
auth_param basic realm Login to access proxy server
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off

acl authenticated proxy_auth REQUIRED

http_access deny !authenticated all
http_access allow all

Save squid.conf file and then create a new user/password in terminal by following command:

htpasswd -c /etc/squid/passwd squiduser

To change a password use

htpasswd /etc/squid/passwd squiduser

After squid service restarted, proxy client should ask for a username password.

Change Visible Host Name

To change host name for squid, put a line in configuration file like below:

visible_hostname samplehostname.com


Simple and Easy Proxy: Tinyproxy

If you are looking for simple and easy proxy server solution, you can try tinyproxy.

Install it by

sudo apt-get install tinyproxy

Edit configuration file

sudo scite /etc/tinyproxy.conf

And restart the proxy server

sudo service tinyroxy restart

That's it!

References:

Share Share Editor: editor | Posted: 2012/11/21 | Views: 11745

Comments

6 + 6 =
Ed 09/18/2013 17:12:04
Recently I setup a Reverse Proxy Server with Squid (server accelerator) and wrote a full detailed tutorial that you can find in:

http://cosmolinux.no-ip.org/raconetlinux/html/17-squid.html

I wish it is useful to someone.
Home | Search | Contact | Terms
Editor