Tips Enable SSL on Amazon Linux 2

dactrongtrankim

New member
[TIẾNG VIỆT]:
** Cách bật SSL trên Amazon Linux 2 **

SSL (Lớp ổ cắm bảo mật) là một giao thức bảo mật mã hóa dữ liệu được gửi giữa trình duyệt web và máy chủ.Điều này giúp bảo vệ thông tin nhạy cảm, chẳng hạn như số thẻ tín dụng và mật khẩu, khỏi bị chặn bởi các tác nhân độc hại.

Kích hoạt SSL trên Amazon Linux 2 là một quy trình tương đối đơn giản.Trong hướng dẫn này, chúng tôi sẽ chỉ cho bạn cách thực hiện bằng cách sử dụng các bước sau:

1. ** Cài đặt gói OpenSSL. **

Gói OpenSSL cung cấp các công cụ bạn cần để tạo và quản lý chứng chỉ SSL.Để cài đặt nó, hãy chạy lệnh sau:

`` `
SUDO YUM Cài đặt OpenSSL
`` `

2. ** Tạo khóa riêng và yêu cầu ký chứng chỉ (CSR). **

Để tạo khóa riêng và CSR, hãy chạy lệnh sau:

`` `
OpenSSL Req -New -Newkey RSA: 2048 -Nodes -keyout private.key -out csr.pem
`` `

Điều này sẽ nhắc bạn nhập một số chi tiết, chẳng hạn như tên, tổ chức và quốc gia của bạn.

3. ** ký vào CSR với cơ quan chứng chỉ (CA). **

CA là một thực thể đáng tin cậy có thể cấp chứng chỉ kỹ thuật số.Bạn có thể mua chứng chỉ từ CA thương mại hoặc bạn có thể tạo CA của riêng mình.

Để tạo CA của riêng bạn, bạn có thể sử dụng các bước sau:

1. Tạo khóa riêng CA và chứng chỉ CA.
2. Nhập chứng chỉ CA vào trình duyệt web của bạn.
3. Sử dụng khóa riêng CA để ký CSR bạn đã tạo trong bước trước.

4. Nhập chứng chỉ đã ký vào máy chủ web của bạn.

Để nhập chứng chỉ đã ký vào máy chủ web của bạn, bạn sẽ cần chỉnh sửa tệp cấu hình của máy chủ.Vị trí của tệp này sẽ thay đổi tùy thuộc vào máy chủ web bạn đang sử dụng.

Khi bạn đã định vị tệp cấu hình, bạn sẽ cần thêm các dòng sau:

`` `
<Virtualhost *: 443>
Trò chơi servername.com
Sslengine trên
Sslcertificatefile /etc/ssl/certs/server.crt
SSLCERTITEDKEYFILE /ETC/SSL/PRIVATE/SERVER.KEY
</Virtualhost>
`` `

5. Khởi động lại máy chủ web.

Khi bạn đã khởi động lại máy chủ web, bạn sẽ có thể truy cập trang web của mình bằng HTTPS.

** Bài viết tham khảo: **

* [Cách bật SSL trên Apache] (https://www.digitalocean.com/community/tutorials/how-to-enable-ssl-on-apache-on-ubuntu-18-04)
* [Cách bật SSL trên Nginx] (https://www.digitalocean.com/community/tutorials/how-to-enable-ssl-ninx-on-ubuntu-18-04)

[ENGLISH]:
**How to Enable SSL on Amazon Linux 2**

SSL (Secure Sockets Layer) is a security protocol that encrypts data sent between a web browser and a server. This helps to protect sensitive information, such as credit card numbers and passwords, from being intercepted by malicious actors.

Enabling SSL on Amazon Linux 2 is a relatively simple process. In this tutorial, we will show you how to do it using the following steps:

1. **Install the OpenSSL package.**

The OpenSSL package provides the tools you need to create and manage SSL certificates. To install it, run the following command:

```
sudo yum install openssl
```

2. **Generate a private key and a certificate signing request (CSR).**

To generate a private key and a CSR, run the following command:

```
openssl req -new -newkey rsa:2048 -nodes -keyout private.key -out csr.pem
```

This will prompt you to enter a number of details, such as your name, organization, and country.

3. **Sign the CSR with a certificate authority (CA).**

A CA is a trusted entity that can issue digital certificates. You can either purchase a certificate from a commercial CA, or you can create your own CA.

To create your own CA, you can use the following steps:

1. Generate a CA private key and a CA certificate.
2. Import the CA certificate into your web browser.
3. Use the CA private key to sign the CSR you generated in the previous step.

4. Import the signed certificate into your web server.

To import the signed certificate into your web server, you will need to edit the server's configuration file. The location of this file will vary depending on the web server you are using.

Once you have located the configuration file, you will need to add the following lines:

```
<VirtualHost *:443>
ServerName example.com
SSLEngine on
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
</VirtualHost>
```

5. Restart the web server.

Once you have restarted the web server, you should be able to access your website using HTTPS.

**Reference articles:**

* [How to Enable SSL on Apache](https://www.digitalocean.com/community/tutorials/how-to-enable-ssl-on-apache-on-ubuntu-18-04)
* [How to Enable SSL on Nginx](https://www.digitalocean.com/community/tutorials/how-to-enable-ssl-on-nginx-on-ubuntu-18-04)
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top