在CentOS系統上使用OpenSSL主要涉及安裝、配置以及執行一些基本操作。以下是一個詳細的教程:
sudo yum update
sudo yum install openssl openssl-devel
安裝完成后,可以通過以下命令驗證OpenSSL是否正確安裝:
openssl version
openssl genrsa -out private_key.pem 2048
openssl req -new -x509 -key private_key.pem -out certificate.pem -days 365
openssl x509 -in certificate.pem -text -noout
openssl enc -aes-256-cbc -salt -in input_file.txt -out encrypted_file.txt -pass pass:your_password
openssl enc -aes-256-cbc -d -in encrypted_file.txt -out decrypted_file.txt -pass pass:your_password
openssl req -new -x509 -key server.key -out server.crt -days 365
sudo vi /etc/nginx/nginx.conf
在http
塊中添加以下內容:
ssl_certificate /path/to/server.crt;
ssl_certificate_key /path/to/server.key;
sudo systemctl restart nginx
https://your_server_ip
,檢查是否顯示安全的鎖定圖標,并確認證書信息。以上就是在CentOS系統上使用OpenSSL的基本教程,希望對您有所幫助。