Build an https Server (apache) using CentOS)

Source: Internet
Author: User

Build an https Server (apache) using CentOS)
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-zxfopenssl-0.9.8k.tar.gz // unzip the installation package
Cdopenssl-0.9.8k // enter the unzipped installation package
./Config // configure and install. We recommend that you use the default configuration.
Make & makeinstall // 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 & makeinstall
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. opensslreq-new-text-outserver.req

2. opensslrsa-inprivkey.pem-outserver.key

3. opensslreq-x509-inserver.req-text-keyserver.key-outserver.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
# LoadModulessl_modulemodules/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:
SSLCertificateFileconf/ssl. crt/server. crt: Configure the server certificate to this path.
SSLCertificateKeyFileconf/ssl. key/server. key: configure the private key of the server certificate to this path.
# SSLCertificateChainFileconf/ssl. crt/ca. crt Delete the comment "#" at the beginning of the line, and configure the 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
./Apachectlstart

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;

Reference:

Http://sarsgetaway.iteye.com/blog/1121495

Http://www.postgresql.org/docs/8.4/static/ssl-tcp.html


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.