Fix lỗi PEM routines:PEM_read_bio:bad end line error trên Nginx – Cuongquach.com | Khi mà bạn tiến hành cấu hình SSL Intermediate Certificate trên Web server Nginx thì bạn gặp phải thông báo lỗi như sau, khi khởi động lại Nginx :
(SSL: error:0906D066:PEM routines:PEM_read_bio:bad end line)
Contents
Nguyên nhân
Sau khi kiểm tra thì thấy nội dung certificate trong file cert bị lỗi nối đuôi nhau giữa các thông tin intermediate certificate nên dẫn đến lỗi “PEM routines:PEM_read_bio:bad end line error” phát sinh trên.
Cấu hình nội dung file Certificate bị lỗi
# vi /etc/nginx/ssl/ssl-domain.crt -----END CERTIFICATE----------BEGIN CERTIFICATE-----
Xử lý
Xử lý khá đơn giản, nếu đúng như tình trạng trên thì bạn chỉ cần tách biệt nội dung ‘END’ và ‘BEGIN’ xuống dòng với nhau là xong. Đảm bảo dấu ‘–‘ mỗi bên của ‘END’ và ‘BEGIN’ là 5 dấu ‘-‘ nhé.
-----END CERTIFICATE----- -----BEGIN CERTIFICATE-----
Sau đó bạn khởi động lại hệ thống Web Server Nginx xem còn lỗi không nhé.
Nguồn: https://cuongquach.com/
Fix error SSL PEM routines:PEM_read_bio:bad end line
When you configure SSL Certificate on Web Server Nginx and your SSL Intermediate Certificate bundle has something strange to make appear an error when we restart Nginx web server like below :
(SSL: error:0906D066:PEM routines:PEM_read_bio:bad end line)
Ok, you encountered that issue and what is causing of it.
Reason cause “PEM routines:PEM_read_bio:bad end line”
No line break has been created between each start and end points of Intermediate Certificate within the file certificate bundle, i.e.
# cat /etc/nginx/ssl/ssl-domain.crt -----END CERTIFICATE----------BEGIN CERTIFICATE-----
This can cause some serious issues because it cannot be interpreted, as you might have noticed.
How to Fix SSL PEM routines:PEM_read_bio:bad end line error
To fix this issue, fire up your text editor of choice and create a line break between the two files, i.e.
-----END CERTIFICATE----- -----BEGIN CERTIFICATE-----
Tip: Count five hyphens at the start and end of the text. You can now save the file and the error should be fixed!
Nguồn: https://cuongquach.com/