Tuesday, February 16, 2010

centos install https web server

1, Install the required software
yum install mod_ssl openssl

2, Generate a self-signed certificate
cd /home/greg/
ls
mkdir certificate
cd certificate/
openssl genrsa -out localhost.key 1024
ll
less localhost.key
openssl req -new -key localhost.key -out localhost.csr
ll
openssl x509 -req -days 365 -in localhost.csr -signkey localhost.key -out localhost.crt
ll

3, copy the files to the correct locations
mv localhost.crt /etc/pki/tls/certs/
ll
mv * /etc/pki/tls/private/
ll
ll /etc/pki/tls/private/

4, Then, update the Apache SSL configuration file
vim /etc/httpd/conf.d/ssl.conf

SSLCertificateFile /etc/pki/tls/certs/localhost.crt

# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you've both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key


5, restart apache
/etc/init.d/httpd restart

No comments:

Post a Comment