> For the complete documentation index, see [llms.txt](https://www.devops.buzz/public/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.devops.buzz/public/squid/setup-server.md).

# Setup server

## Install squid

```bash
apt update
apt install squid squid-common
```

## Setup squid

### Allow all (not recommended for production)

Edit config file:

```bash
nano /etc/squid3/squid.conf
```

Find the following line:

```
http_access deny all
```

**BEFORE** this line add:

```
acl all src 0.0.0.0/0
http_access allow all
```

### Basic auth

Edit config file:

```bash
nano /etc/squid3/squid.conf
```

Find the following line:

```
http_access deny all
```

**BEFORE** this line add:

```
acl all src 0.0.0.0/0
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid3/passwords
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
```

#### Add user

Run:

```
htpasswd -c /etc/squid3/passwords YOUR-USER-NAME-HERE
```

Input your password twice.

#### Setup client&#x20;

```
export http_proxy="http://USER:PASSWORD@PROXY-HOST:3128"
export https_proxy="http://USER:PASSWORD@PROXY-HOST:3128"
export ftp_proxy="http://USER:PASSWORD@PROXY-HOST:3128"
export no_proxy="localhost,127.0.0.1,::1"
curl http://www.google.com
```
