Linux Proxy Server Configuration. Squid is an internet proxy server built for Linux OSX that can be used within a LAN to distribute an internet connection to all the computers within the network. One central computer is connected to the internet and with squid running acts as a proxy server and firewall to the internet. As a proxy server it has the capabilities to log all user actions such as the URLs visited. There are many features that can be configured in squid. This configuration guide is meant to be a quick start guide for those who are eager to get a linux proxy server squid working and then configure it from there.
Squid uses the configuration file
[php]squid.conf[/php]
. It is usually located in the
[php]/etc/squid[/php]
directory. Access through the proxy can be given by individual IP addresses or by a subnet of IP addresses.
In
[php]squid.conf[/php]
search for the default access control lists(acl) and add the following line below them:
[php]acl allowedhost src 192.168.1.0/255.255.255.0 (for subnet)
acl allowedhost src 192.168.1.10/255.255.255.0 (for individual IP)[/php]
Then add the access control list named “allowedhost” to the http_access list with the following line:
[php]http_access allow allowedhost[/php]
The default port for the proxy is 3128. You can uncomment this and replace 3128 with the desired port :
[php] http_port 3128 [/php]
Assuming you have the runlevel scripts installed you can use the following commands as root:
Start squid | [php]/etc/rc.d/init.d/squid start[/php] |
Restart squid | [php]/etc/rc.d/init.d/squid restart[/php] |
Stop squid | [php]/etc/rc.d/init.d/squid stop[/php] |
or issue the following TWO commands as root:
[php]squid -z[/php]
[php]squid[/php]
or configure squid to start at boot time using your runlevels.
If after you try to start squid you get an error message that reads:
FATAL: Could not determine fully qualified hostname. Please set ‘visible_hostname’
Then you’ll need to set you visible_hostname in your squid.conf like this
visible_hostname user@hostname
Step-by-step how to start and using Squid for the first time.
In order to make sure that the configuration and your Squid proxy server running smoothly, test to start Squid proxy server in debugging mode; The command example below show the step by step to create the Squid cache directory and then running Squid proxy server in debugging mode.
1. Create squid cache directory by issuing this command:
[root@linux fedora]# /usr/sbin/squid -z
2006/03/16 10:33:00| Creating Swap Directories
2. Then test run your Squid cache proxy by running Squid in debug-mode
[root@linux fedora]# /usr/sbin/squid -NCd1
3. In case of a problem of starting your Squid cache proxy try read the Squid log file in these following directory:
[root@linux fedora]# /sbin/service squid start
[root@linux fedora]# /sbin/service squid stop
To make sure Squid automatic start after the system reboot, use the chkconfig command to On Squid on runlevel 3 and 5. (Setting of automatic start on runlevel 3 and 5)
[root@linux fedora]# /sbin/chkconfig –level 35 squid on
(Confirmation of automatic start)
[root@linux fedora]# /sbin/chkconfig –list squid
squid 0:off 1: off 2: off 3: on 4: off 5:on 6: off