Configure SSL for centos and Apache

Source: Internet
Author: User

Enable SSL for centos 5
Install mod_ssl first
Yum install mod_ssl
After completion
There is an SSL. conf file under/etc/httpd/CONF. d/. Open
It mainly looks at the certificate and key location
Sslcertificatefile/etc/pki/tls/certs/localhost. CRT
Sslcertificatekeyfile/etc/pki/tls/private/localhost. Key


Generate a key and enter/etc/pki/tls/private,
Delete the original
Rm-F localhost. Key
Generate a new
OpenSSL genrsa 1024> localhost. Key
Return to the certs directory
CD ../certs
Delete original certificate
Rm-RF localhost. CRT
Generate a new
You can use commands
Make testcert is automatically generated. You can also enter your own command and then centos will prompt you to enter some information, such as country/region email, and write it at will.
OpenSSL req-New-X509-days 365-key ../private/localhost. Key-out localhost. CRT
Enter the required information and the certificate is generated.


The reason for using a name such as localhost. CRT is that it is specified in SSL. conf. The two places must be the same.
Open SSL. conf in/etc/httpd/CONF. D and find
, Change

DocumentRoot "/var/www/html/www"
Servername www.linuxidc.com
Change the information of the SSL domain you need, restart Apache, and end the configuration.
Now we can access the website through HTTPS and receive a warning under IE6, because this is our own certificate.

Related Article

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.