I. Installation preparation
1. Install Openssl
To enable Apache to support SSL, you must first install Openssl support. Openssl-0.9.8k.tar.gz
Download Openssl: http://www.openssl.org/source/
Tar-zxf openssl-0.9.8k.tar.gz // unzip the installation package
Cd openssl-0.9.8k // enter the unzipped installation package
./Config // configure and install. We recommend that you use the default configuration.
Make & make install // compile and install
Openssl will be installed to/usr/local/ssl by default
2. install Apache
Download the httpdsource code from http://httpd.apache.org/here, httpd2.2.22;
. /Configure -- prefix =/usr/local/httpd2.2.22 -- enable-so -- enable-ssl -- with-ssl =/usr/local/ssl -- enable-mod-shared = all // configure and install. Dynamic compilation module recommended
Make & make install
The Apache module is compiled dynamically to facilitate module load management. Apache will be installed in/usr/local/apache
Ii. Generate a certificate
To quickly build an available https server, you must go to the/usr/local/httpd2.2.22/conf/directory
(It can also be generated in another directory. Copy the generated file to the/usr/local/httpd2.2.22/conf/directory)
Run the following commands in sequence:
1. openssl req-new-text-out server. req
2. openssl rsa-in privkey. pem-out server. key
3. openssl req-x509-in server. req-text-key server. key-out server. crt
For more information, see the openssl document;
Iii. Apache configuration
Open the httpd. conf file in the conf directory under the apache installation directory and find
# LoadModule ssl_module modules/mod_ssl.so
Delete the configuration statement comment symbol "#" at the beginning of the line
Save and exit.
Open the ssl. conf file in the conf directory under the apache installation directory and find
Find the following configuration statement in the configuration file:
SSLCertificateFile conf/ssl. crt/server. crt Configure the server certificate to this path
SSLCertificateKeyFile conf/ssl. key/server. key: configure the private key of the server certificate to this path.
# SSLCertificateChainFile conf/ssl. crt/ca. crt Delete the comment "#" at the beginning of the line, and configure intermediate CA certificate intermediate. crt to this path
Save and exit, and restart Apache. Restart Method:
Go to the bin directory under the Apache installation directory and run the following command:
./Apachectl-k-stop
./Apachectl start
Access your site through https and test the installation and configuration of the site certificate.
In this case, you can access the established server through http and https;