# Squid

## 安装

```
yum -y install squid
```

安装的版本为

```
squid.x86_64 7:3.5.20-2.el7_3.3 @updates
```

## 配置

* /etc/squid/squid.conf

用如下两行覆盖

```
http_port 3128 # 如果只监听ipv4，则该行设为 http_port 0.0.0.0:3128
http_access allow all
```

* /usr/lib/systemd/system/squid.service

```
[Unit]
Description=Squid caching proxy
After=syslog.target network.target nss-lookup.target

[Service]
Type=forking
LimitNOFILE=16384
EnvironmentFile=/etc/sysconfig/squid
ExecStartPre=/usr/libexec/squid/cache_swap.sh
ExecStart=/usr/sbin/squid $SQUID_OPTS -f $SQUID_CONF
ExecReload=/usr/sbin/squid $SQUID_OPTS -k reconfigure -f $SQUID_CONF
ExecStop=/usr/sbin/squid -k shutdown -f $SQUID_CONF
TimeoutSec=0

[Install]
WantedBy=multi-user.target
```

## 启动

```
systemctl start squid
```

## 验证

```
[root@master squid]# ps -ef | grep squid
root 31417 82275 0 10:01 pts/1 00:00:00 grep --color=auto squid
root 128368 1 0 09:12 ? 00:00:00 /usr/sbin/squid -f /etc/squid/squid.conf
squid 128370 128368 0 09:12 ? 00:00:00 (squid-1) -f /etc/squid/squid.conf
squid 128371 128370 0 09:12 ? 00:00:00 (logfile-daemon) /var/log/squid/access.log
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pshizhsysu.gitbook.io/linux/chang-yong-ruan-jian-an-zhuang-pian/squid.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
