在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的基本教程,希望对您有所帮助。