Proxy Ubuntu Server 20.04: Cài đặt và cấu hình proxy trên Ubuntu Server.

## Cách cài đặt và định cấu hình máy chủ proxy trên Ubuntu 20.04

Máy chủ proxy là một máy chủ hoạt động như một trung gian giữa máy khách và máy chủ.Khi máy khách yêu cầu tài nguyên từ máy chủ, máy chủ proxy chuyển tiếp yêu cầu đến máy chủ từ xa và sau đó trả lại phản hồi cho máy khách.Điều này có thể được sử dụng để cải thiện hiệu suất, bảo mật và/hoặc quyền riêng tư.

Trong hướng dẫn này, chúng tôi sẽ chỉ cho bạn cách cài đặt và định cấu hình máy chủ proxy trên Ubuntu 20.04.Chúng tôi sẽ sử dụng máy chủ proxy Squid, đây là máy chủ proxy miễn phí và nguồn mở có sẵn cho nhiều nền tảng khác nhau.

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

Để làm theo hướng dẫn này, bạn sẽ cần những điều sau đây:

* Một máy chủ đang chạy Ubuntu 20.04
* Người dùng không root có đặc quyền sudo

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

Để cài đặt SQUID, hãy chạy lệnh sau:

`` `
sudo apt cài đặt mực
`` `

Điều này sẽ cài đặt máy chủ proxy Squid và tất cả các phụ thuộc của nó.

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

Tệp cấu hình mực được đặt tại `/etc/squid/squid.conf`.Bạn có thể chỉnh sửa tệp này bằng trình chỉnh sửa văn bản yêu thích của bạn.

Sau đây là một số tùy chọn cấu hình quan trọng nhất cho Squid:

* `http_port`: Tùy chọn này chỉ định số cổng mà Squid sẽ lắng nghe các yêu cầu HTTP.
* `http_access`: Tùy chọn này chỉ định máy khách nào được phép truy cập máy chủ proxy.
* `Cache_dir`: Tùy chọn này chỉ định thư mục nơi Squid sẽ lưu trữ bộ đệm của nó.

Để biết thêm thông tin về các tùy chọn cấu hình của Squid, vui lòng tham khảo tài liệu mực.

### 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 systemctl bắt đầu mực
`` `

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

`` `
SUDO SystemCTL Squid
`` `

### Kiểm tra mực

Bạn có thể kiểm tra SQUID bằng cách sử dụng lệnh sau để kết nối với trang web thông qua máy chủ proxy:

`` `
Curl -x http: // localhost: 3128 https://www.google.com.com
`` `

Nếu lệnh thành công, bạn sẽ thấy trang chủ Google trong trình duyệt của bạn.

### Bảo vệ mực

Theo mặc định, Squid không an toàn lắm.Bạn nên thực hiện các bước để bảo đảm mực bằng cách định cấu hình các tùy chọn sau:

* `http_access`: Tùy chọn này chỉ định máy khách nào được phép truy cập máy chủ proxy.
* `auth_param`: Tùy chọn này chỉ định phương thức xác thực mà Squid sẽ sử dụng.
* `auth_user_file`: Tùy chọn này chỉ định tệp chứa tên người dùng và mật khẩu cho người dùng được phép truy cập máy chủ proxy.

Để biết thêm thông tin về việc đảm bảo mực, vui lòng tham khảo tài liệu mực.

### Phần kết luận

Trong hướng dẫn này, bạn đã học cách cài đặt và định cấu hình máy chủ proxy trên Ubuntu 20.04.Bạn có thể sử dụng máy chủ proxy để cải thiện hiệu suất, bảo mật và/hoặc quyền riêng tư.

###### Hashtags

* #Ủy quyền
* #ubuntu
* #mực ống
* #NetWorking
* #bảo vệ
=======================================
## How to Install and Configure a Proxy Server on Ubuntu 20.04

A proxy server is a server that acts as an intermediary between a client and a server. When a client requests a resource from a server, the proxy server forwards the request to the remote server and then returns the response to the client. This can be used to improve performance, security, and/or privacy.

In this tutorial, we will show you how to install and configure a proxy server on Ubuntu 20.04. We will be using the Squid proxy server, which is a free and open-source proxy server that is available for a variety of platforms.

### Prerequisites

To follow this tutorial, you will need the following:

* A server running Ubuntu 20.04
* A non-root user with sudo privileges

### Installing Squid

To install Squid, run the following command:

```
sudo apt install squid
```

This will install the Squid proxy server and all of its dependencies.

### Configuring Squid

The Squid configuration file is located at `/etc/squid/squid.conf`. You can edit this file using your favorite text editor.

The following are some of the most important configuration options for Squid:

* `http_port`: This option specifies the port number that Squid will listen on for HTTP requests.
* `http_access`: This option specifies which clients are allowed to access the proxy server.
* `cache_dir`: This option specifies the directory where Squid will store its cache.

For more information on Squid's configuration options, please refer to the Squid documentation.

### Starting Squid

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

```
sudo systemctl start squid
```

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

```
sudo systemctl status squid
```

### Testing Squid

You can test Squid by using the following command to connect to a website through the proxy server:

```
curl -x http://localhost:3128 https://www.google.com
```

If the command succeeds, you will see the Google homepage in your browser.

### Securing Squid

By default, Squid is not very secure. You should take steps to secure Squid by configuring the following options:

* `http_access`: This option specifies which clients are allowed to access the proxy server.
* `auth_param`: This option specifies the authentication method that Squid will use.
* `auth_user_file`: This option specifies the file that contains the usernames and passwords for users who are allowed to access the proxy server.

For more information on securing Squid, please refer to the Squid documentation.

### Conclusion

In this tutorial, you learned how to install and configure a proxy server on Ubuntu 20.04. You can use a proxy server to improve performance, security, and/or privacy.

###### Hashtags

* #Proxy
* #ubuntu
* #squid
* #NetWorking
* #security
 
Join ToolsKiemTrieuDoGroup
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock