Configuring Apache support for HTTPS

Source: Internet
Author: User

First, installation preparation
1. Installing OpenSSL
to enable Apache to support SSL, you need to install OpenSSL support first. Openssl-0.9.8k.tar.gz is used here.
Downloadopenssl:http://www.openssl.org/source/
TAR-ZXF openssl-0.9.8k.tar.gz//Unzip the installation package
CD openssl-0.9.8k//Enter the installed package that has been unzipped
./config//Configuration installation. Recommended default configuration
Make && make install //compile and install
OpenSSL will be installed to/usr/local/ssl by default

2. Installing Apache

Download the httpd source code from http://httpd.apache.org/, here is the use of httpd2.2.22;
./configure--prefix=/usr/local/httpd2.2.22--enable-so--enable-ssl--with-ssl=/usr/local/ssl--enable-mods-shared =all//Configuration installation. Recommended Dynamic Compilation Module
Make && make install
The Apache module is dynamically compiled for easy loading and management of modules. Apache will be installed to/usr/local/apache

Ii. Certificate of Generation

In order to quickly build an available HTTPS server, you need to be in the/usr/local/httpd2.2.22/conf/directory

(can also be generated under another directory, copy the generated files to the/usr/local/httpd2.2.22/conf/directory)

Run the following command in turn:

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

Specific reference to the OpenSSL documentation;

Iii. Configuration of Apache

Open the httpd.conf file in the Conf directory under the Apache installation directory to find
#LoadModule Ssl_module modules/mod_ssl.so
Delete the configuration statement comment symbol "#" at the beginning of the line
Save exit.
Open the ssl.conf file in the Conf directory under the Apache installation directory to find
Look for 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 server certificate private key under this path
#SSLCertificateChainFile conf/ssl.crt/ca.crt Remove the "#" comment from the beginning of the line and configure the intermediate CA certificate intermediate.crt to that path
Save the exit and restart Apache. Restart mode:
Go to the Bin directory under the Apache installation directory and run the following command
./apachectl-k-stop
./apachectl Start

Access your site over HTTPS to test the installation configuration of the site certificate.

At this point, the server can be accessed through HTTP and HTTPS;

Configuring Apache support for HTTPS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.