Install OpenSSL on apache (Linux)
Check if openssl is installed:
rpm -qa openssl
Create server.key
openssl genrsa -des3 -out server.key 2048
Create server.csr
openssl req -new -key server.key -out server.csr
Remove password for convenience you will be asked password for each time the service starts if the password exits.
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
list files created from typing "ll server*"
rpm -qa openssl
Create server.key
openssl genrsa -des3 -out server.key 2048
Create server.csr
openssl req -new -key server.key -out server.csr
Remove password for convenience you will be asked password for each time the service starts if the password exits.
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
list files created from typing "ll server*"
-rw-r--r--.
1 root root 1054 Sep 20 07:53 server.csr
-rw-r--r--.
1 root root 1679 Sep 20 07:56 server.key
-rw-r--r--.
1 root root 1751 Sep 20 07:55 server.key.org
Create certificate
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
cp server.key /etc/httpd/conf/
cp server.crt /etc/httpd/conf/
ll /etc/httpd/conf
total 60
-rw-r--r--.
1 root root 34417 Sep 20 07:41 httpd.conf
-rw-r--r--.
1 root root 13139 Feb 14 2012 magic
-rw-r--r--.
1 root root 1298 Sep 20 08:45 server.crt
-rw-r--r--.
1 root root 1679 Sep 20 08:45 server.key
httpd.conf configuration
Add below at the end of the file
---------------------------
NameVirtualHost
*:443
SSLEngine on
SSLCertificateFile
/etc/httpd/conf/server.crt
SSLCertificateKeyFile
/etc/httpd/conf/server.key
SetEnvIf
User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
CustomLog
logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x
\"%r\" %b"
DocumentRoot [folder path]
---------------------------
※DocumentRoot is your actual folder path
service
httpd restart
Comments
Post a Comment