Tips Cài đặt Squid proxy trên Linux để dùng riêng tư

TricksMMO

Administrator
Staff member
#SquidProxy #linux #Privacy #Security #NetWorking

## Cài đặt Proxy Squid trên Linux để bảo mật

Squid là máy chủ proxy miễn phí và nguồn mở, có thể được sử dụng để cải thiện hiệu suất và bảo mật mạng của bạn.Nó cũng có thể được sử dụng để chặn quảng cáo và Tracke, làm cho nó trở thành một lựa chọn tốt cho người dùng có đầu óc riêng tư.

Trong hướng dẫn này, chúng tôi sẽ chỉ cho bạn cách cài đặt Squid trên máy chủ Linux.Chúng tôi sẽ sử dụng Ubuntu 20.04, nhưng các hướng dẫn phải tương tự cho các bản phân phối Linux khác.

### Điều kiện tiên quyết

Trước khi bắt đầu, bạn sẽ cần phải có những điều kiện tiên quyết sau:

* Máy chủ Linux chạy Ubuntu 20.04
* Người dùng không root có đặc quyền sudo
* Các gói sau được cài đặt:
* `apt-get install squid`
* `apt-get install squid-deb-proxy`

### Cài đặt mực

Để cài đặt SQUID, chỉ cần chạy lệnh sau:

`` `
SUDO apt-get install Squid
`` `

Điều này sẽ cài đặt phiên bản mới nhất của Squid trên máy chủ của bạn.

### Cấu hình mực

Khi Squid được cài đặt, bạn sẽ cần phải định cấu hình nó.Tệp cấu hình mực được đặt tại `/etc/squid/squid.conf`.

Để mở tệp cấu hình, hãy chạy lệnh sau:

`` `
sudo nano /etc/squid/squid.conf
`` `

Tệp cấu hình mực được chia thành một số phần.Phần quan trọng nhất đối với chúng tôi là phần `http_access`.Phần này kiểm soát khách hàng nào được phép truy cập máy chủ proxy.

Để cho phép tất cả các máy khách truy cập máy chủ proxy, hãy thêm dòng sau vào phần `http_access`:

`` `
http_access cho phép tất cả
`` `

Bạn cũng có thể chỉ định khách hàng nào được phép truy cập các trang web cụ thể bằng cách sử dụng các chỉ thị `http_access cho phép` và` http_access deny`.

Ví dụ: dòng sau đây sẽ cho phép các máy khách từ mạng con 192.168.1.0/24 để truy cập tất cả các trang web:

`` `
http_access cho phép 192.168.1.0/24
`` `

Dòng sau đây sẽ từ chối khách hàng từ mạng con 192.168.1.0/24 truy cập trang web `www.example.com`:

`` `
http_access từ chối 192.168.1.0/24 www.example.com
`` `

Để biết thêm thông tin về cấu hình mực, vui lòng tham khảo [tài liệu mực] (https://www.squid-cache.org/doc/config/).

### Bắt đầu mực

Khi bạn đã cấu hình SQUID, bạn có thể khởi động máy chủ proxy bằng cách chạy lệnh sau:

`` `
SUDO Service Squid Start
`` `

Bạn có thể xác minh rằng Squid đang chạy bằng cách chạy lệnh sau:

`` `
sudo netstat -lnp |GREP SQUID
`` `

Bạn sẽ thấy đầu ra tương tự như sau:

`` `
TCP 0 0 0.0.0.0:3128 0.0.0.0:* Nghe 4967/SQUID
`` `

### Kiểm tra mực

Bạn có thể kiểm tra mực bằng cách mở trình duyệt web và nhập URL sau:

`` `
http: // localhost: 3128
`` `

Bạn sẽ xem trang Chào mừng Squid.

Bạn cũng có thể kiểm tra mực bằng cách sử dụng lệnh sau:

`` `
Curl -x Localhost: 3128 www.example.com
`` `

Bạn sẽ xem nội dung của trang web `www.example.com`.

### Xử lý sự cố mực

Nếu bạn đang gặp rắc rối với Squid, có một vài điều bạn có thể kiểm tra.

Đầu tiên, hãy đảm bảo rằng Squid đang chạy và tệp cấu hình là chính xác.Bạn có thể kiểm tra trạng thái của mực bằng cách chạy lệnh sau:

`` `
Trạng thái SUDO Service Squid
`` `

Bạn cũng có thể kiểm tra tệp cấu hình mực bằng cách chạy lệnh sau:

`` `
sudo cat /etc/squid/squid.conf
`` `

Nếu Squid không chạy hoặc tệp cấu hình không chính xác, bạn sẽ cần
=======================================
#SquidProxy #linux #Privacy #Security #NetWorking

## Install Squid Proxy on Linux for Privacy

Squid is a free and open-source proxy server that can be used to improve the performance and security of your network. It can also be used to block ads and tracke, making it a good option for privacy-minded users.

In this tutorial, we will show you how to install Squid on a Linux server. We will be using Ubuntu 20.04, but the instructions should be similar for other Linux distributions.

### Prerequisites

Before you begin, you will need to have the following prerequisites:

* A Linux server running Ubuntu 20.04
* A non-root user with sudo privileges
* The following packages installed:
* `apt-get install squid`
* `apt-get install squid-deb-proxy`

### Installing Squid

To install Squid, simply run the following command:

```
sudo apt-get install squid
```

This will install the latest version of Squid on your server.

### Configuring Squid

Once Squid is installed, you will need to configure it. The Squid configuration file is located at `/etc/squid/squid.conf`.

To open the configuration file, run the following command:

```
sudo nano /etc/squid/squid.conf
```

The Squid configuration file is divided into several sections. The most important section for us is the `http_access` section. This section controls which clients are allowed to access the proxy server.

To allow all clients to access the proxy server, add the following line to the `http_access` section:

```
http_access allow all
```

You can also specify which clients are allowed to access specific websites by using the `http_access allow` and `http_access deny` directives.

For example, the following line would allow clients from the 192.168.1.0/24 subnet to access all websites:

```
http_access allow 192.168.1.0/24
```

The following line would deny clients from the 192.168.1.0/24 subnet from accessing the website `www.example.com`:

```
http_access deny 192.168.1.0/24 www.example.com
```

For more information on configuring Squid, please refer to the [Squid documentation](https://www.squid-cache.org/doc/config/).

### Starting Squid

Once you have configured Squid, you can start the proxy server by running the following command:

```
sudo service squid start
```

You can verify that Squid is running by running the following command:

```
sudo netstat -lnp | grep squid
```

You should see output similar to the following:

```
tcp 0 0 0.0.0.0:3128 0.0.0.0:* LISTEN 4967/squid
```

### Testing Squid

You can test Squid by opening a web browser and entering the following URL:

```
http://localhost:3128```

You should see the Squid welcome page.

You can also test Squid by using the following command:

```
curl -x localhost:3128 www.example.com
```

You should see the contents of the `www.example.com` website.

### Troubleshooting Squid

If you are having trouble with Squid, there are a few things you can check.

First, make sure that Squid is running and that the configuration file is correct. You can check the status of Squid by running the following command:

```
sudo service squid status
```

You can also check the Squid configuration file by running the following command:

```
sudo cat /etc/squid/squid.conf
```

If Squid is not running or the configuration file is incorrect, you will need to
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top