[root@server ssl]# yum install openssl mod_ssl [root@server ssl]# ls /etc/httpd/modules/mod_ssl.so /etc/httpd/modules/mod_ssl.so[root@server ssl]# vi /etc/pki/tls/openssl.cnf [root@server ssl]# cd /etc/pki/tls/misc/[root@server ssl]# ./CA -newca[root@server ssl]# ---->ls /etc/pki/CA/<>[root@server ssl]# mkdir /etc/httpd/ssl[root@server ssl]# cd /etc/httpd/ssl/[root@server ssl]# openssl genrsa -des3 -out server.key[root@server ssl]# openssl req -new -key server.key >server.csr[root@server ssl]# openssl x509 -req -days 3650 < server.csr -signkey server.key > server.crt[root@server ssl]# cp /etc/pki/CA/cacert.pem /etc/httpd/ssl/server.pem[root@server ssl]# vi /etc/httpd/conf.d/ssl.conf [root@server ssl]# grep SSLCertifi /etc/httpd/conf.d/ssl.conf # Point SSLCertificateFile at a PEM encoded certificate. IfSSLCertificateFile /etc/httpd/ssl/server.crt#SSLCertificateFile /etc/pki/tls/certs/localhost.crt#SSLCertificateKeyFile /etc/pki/tls/private/localhost.keySSLCertificateKeyFile /etc/httpd/ssl/server.key# Point SSLCertificateChainFile at a file containing the# the referenced file can be the same as SSLCertificateFile#SSLCertificateChainFile /etc/pki/tls/certs/server-chain.crt[root@server ssl]# grep SSLCACertifi /etc/httpd/conf.d/ssl.conf #SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crtSSLCACertificateFile /etc/httpd/ssl/server.pem[root@server ssl]# /etc/init.d/httpd restart Stopping httpd: [FAILED]Starting httpd: Apache/2.2.3 mod_ssl/2.2.3 (Pass Phrase Dialog)Some of your private key files are encrypted for security reasons.In order to read them you have to provide the pass phrases.Server server.uplooking.com:443 (RSA)Enter pass phrase:OK: Pass Phrase Dialog successful. [ OK ]输入的密码是生成server.key的密码 。这个时候 netstat -an|grep :443可以工作了 firefix https://ip 可以使用https加密了。如果觉得启动httpd不要密码则如下处理:[root@server ssl]# openssl rsaserver.nokey
Enter pass phrase:
writing RSA key
[root@server ssl]# ll
total 40
-rw-r--r-- 1 root root 749 Mar 11 15:16 server.crt
-rw-r--r-- 1 root root 509 Mar 11 15:14 server.csr
-rw-r--r-- 1 root root 573 Mar 11 15:12 server.key
-rw-r--r-- 1 root root 497 Mar 11 15:28 server.nokey
-rw-r--r-- 1 root root 3168 Mar 11 15:21 server.pem
[root@server ssl]# vi /etc/httpd/conf.d/ssl.conf
[root@server ssl]# grep SSLCertifi /etc/httpd/conf.d/ssl.conf
# Point SSLCertificateFile at a PEM encoded certificate. If
SSLCertificateFile /etc/httpd/ssl/server.crt
#SSLCertificateFile /etc/pki/tls/certs/localhost.crt
#SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
SSLCertificateKeyFile /etc/httpd/ssl/server.nokey
# Point SSLCertificateChainFile at a file containing the
[root@server ssl]# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@server ssl]#