个人工具

“UbuntuHelp:Squid”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(创建新页面为 '{{From|https://help.ubuntu.com/community/Squid}} {{Languages|UbuntuHelp:Squid}} == Introduction == Squid is a Proxy server This howto describes the process of setting up Squid a...')
 
 
(未显示同一用户的1个中间版本)
第36行: 第36行:
 
</nowiki></pre>
 
</nowiki></pre>
 
You'll need to change 192.168.1.0/24 to match your network.  Unless you have a second subnet you can delete 192.168.2.0/24
 
You'll need to change 192.168.1.0/24 to match your network.  Unless you have a second subnet you can delete 192.168.2.0/24
 +
Above, the first four sets of numbers, separated by periods ("."), form the IP address of your local area network. The last number, after the slash ("/"), is the netmask of your network and depends on your router settings. This is usually 24, meaning that the first three sets of numbers in the IP address only correspond to computers in your network while all others exist outside of it. Other netmasks are explained [http://unixwiz.net/techtips/netmask-ref.html here].
 
if you get a startup error :-
 
if you get a startup error :-
 
'FATAL: Could not determine fully qualified hostname. Please set visible_hostname'
 
'FATAL: Could not determine fully qualified hostname. Please set visible_hostname'
第44行: 第45行:
 
</nowiki></pre>
 
</nowiki></pre>
 
Save the file and close gedit
 
Save the file and close gedit
=== Service administration ===
+
=== Service Administration ===
 
Fire up Squid
 
Fire up Squid
 
If it is not running you can use :-
 
If it is not running you can use :-
第54行: 第55行:
 
squid -k reconfigure
 
squid -k reconfigure
 
</nowiki></pre>
 
</nowiki></pre>
=== Customize Squid Error pages ===
+
Squid caches the web pages it serves. If the cache expiration time of the web page is specified, Squid seems to obey it. If you are serving some of the pages, update your page in the Apache directory, Squid won't fetch the new version, instead relying on its cached version until its default expiration time. To flush the Squid cache
 +
<pre><nowiki>
 +
sudo /etc/init.d/squid stop
 +
sudo rm -fr /var/spool/squid/*
 +
sudo squid -z
 +
sudo /etc/init.d/squid start
 +
</nowiki></pre>
 +
=== Customize Squid Error Pages ===
 
Squid can be customized. Learn how to do this [[UbuntuHelp:Squid/Customize|here]].
 
Squid can be customized. Learn how to do this [[UbuntuHelp:Squid/Customize|here]].
 
== See Also ==
 
== See Also ==
A see also section can be used to point users towards other trusted Ubuntu resources. For example, if a page exists in the official documentation on http://help.ubuntu.com, you can link to such a page. This section is optional.
 
 
* [[UbuntuHelp:SquidGuard|SquidGuard]] - Squid Guard
 
* [[UbuntuHelp:SquidGuard|SquidGuard]] - Squid Guard
 
* http://manpages.ubuntu.com/manpages/dapper/en/man8/squid.8.html - Explanation of link.
 
* http://manpages.ubuntu.com/manpages/dapper/en/man8/squid.8.html - Explanation of link.
 
== External Links ==
 
== External Links ==
=== External Links ===
 
 
* [http://www.squid-cache.org Official Squid site]
 
* [http://www.squid-cache.org Official Squid site]
 
* [http://www.squidguard.org/ Official SquidGuard site]
 
* [http://www.squidguard.org/ Official SquidGuard site]

2010年5月20日 (四) 00:16的最新版本

Introduction

Squid is a Proxy server This howto describes the process of setting up Squid as a Proxy Server Squid is a proxy server, HTTP requests are sent to Squid instead of being sent directly to the internet.

Installation

Install Apache

# apt-get install apache2

Install Squid

# apt-get install squid

Key File Locations

File Purpose
/etc/squid/squid.conf Squid configuration file
/var/log/squid/access.log Squid access log file

Configurations

Squid Configuration

The squid.conf file is huge, with hundreds of options. In this howto we will only be changing a few settings. Open the squid.conf file for editing

gksudo gedit /etc/squid/squid.conf

Turn on line numbers in gedit (Edit > Preferences) Find the `http_port tag` (should be on or around line 53, its currently Line 89 in 7.10 release) By default it reads `# http_port 3128` This is the default port that Squid will listen on for requests. If you want to change it, uncomment the line and set the correct port. If you want Squid to listen only on one specific NIC, you can also change the IP address – for example `192.168.1.5:3128` Now we'll setup who is allowed access to the proxy. Find the http_access section (should start around line 1860,line 2589 in 7.04 and line 2608 in 7.10 release) Uncomment these 2 lines:

#http_access allow our_networks

You'll need to change 192.168.1.0/24 to match your network. Unless you have a second subnet you can delete 192.168.2.0/24 Above, the first four sets of numbers, separated by periods ("."), form the IP address of your local area network. The last number, after the slash ("/"), is the netmask of your network and depends on your router settings. This is usually 24, meaning that the first three sets of numbers in the IP address only correspond to computers in your network while all others exist outside of it. Other netmasks are explained here. if you get a startup error :- 'FATAL: Could not determine fully qualified hostname. Please set visible_hostname' you will also need to modify the visible_hostname tag (around line 2909 in 7.10) to:- NOTE: this needs to be added as a new line in 7.10 (not sure about other releases) as there is no commented out line re-introduce.

visible_hostname localhost

Save the file and close gedit

Service Administration

Fire up Squid If it is not running you can use :-

sudo /etc/init.d/squid start|restart|stop

then this will work

squid -k reconfigure

Squid caches the web pages it serves. If the cache expiration time of the web page is specified, Squid seems to obey it. If you are serving some of the pages, update your page in the Apache directory, Squid won't fetch the new version, instead relying on its cached version until its default expiration time. To flush the Squid cache

sudo /etc/init.d/squid stop
sudo rm -fr /var/spool/squid/*
sudo squid -z
sudo /etc/init.d/squid start

Customize Squid Error Pages

Squid can be customized. Learn how to do this here.

See Also

External Links