Tuesday, January 6, 2015

How to set up HTTPS for Apache in CentOS

To set up HTTPS for Apache in CentOS,

you can do as follows:

1. Create a private key:

http://izeye.blogspot.kr/2015/01/how-to-create-private-key.html

2. Create a test certificate:

http://izeye.blogspot.kr/2014/12/create-self-signed-test-certificate-in.html

3. Install mod_ssl:

sudo yum install mod_ssl

4. Configure Apache:

In conf/httpd.conf file:

LoadModule ssl_module /usr/lib64/httpd/modules/mod_ssl.so

Include conf/extra/httpd-ssl.conf

In conf/extra/httpd-ssl.conf file:

SSLPassPhraseDialog  exec:/home/izeye/workspaces/izeye/openssl/pass.sh

ServerName www.izeye.com:443

SSLCertificateFile "/home/izeye/workspaces/izeye/openssl/cacert.pem"

SSLCertificateKeyFile "/home/izeye/workspaces/izeye/openssl/privkey.pem"

In pass.sh:

#!/bin/bash
echo "1234"

Add an execute permission:

chmod +x pass.sh

5. Restart Apache:

sudo bin/apachectl restart

Reference:
http://wiki.centos.org/HowTos/Https

No comments:

Post a Comment