Nginx Apache SSL configuration allows it to support HTTPS protocol access

Source: Internet
Author: User
Tags begin rsa private key free ssl free ssl certificate ssl certificate root directory

First to apply for SSL certificate, recommended to Vauton, Tencent Cloud, Aliyun to apply for a free SSL certificate, convenient not to say, important is through the major browser verification.

Nginx configuration, configure the following items in server:

        Listen 443;
        server_name     www.daixh.com; #修改成你的域名, To be consistent with the requested certificate domain name
        index index.html index.htm index.php default.html Default.htm default.php;
        root /data/wwwroot;
        SSL on;
        ssl_certificate/home/ssl/ssl.crt;
        Ssl_certificate_key/home/ssl/ssl.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        ssl_ciphers ecdhe-rsa-aes256-gcm-sha384: ecdhe-rsa-aes128-gcm-sha256:ecdhe-rsa-aes256-sha384:

ecdhe-rsa-aes128-sha256:ecdhe-rsa-rc4-sha:ecdhe-rsa-aes256-sha:dhe-rsa-aes256-sha:dhe-

rsa-aes128-sha:rc4-sha:!anull:!enull:! export:! des:!3des:! md5:! Dss:! PKS;

Ssl_session_cache builtin:1000 shared:ssl:10m;

apache2.* configuration:

The 1_www.domain.com_cert.crt file includes the two-paragraph certificate Code "-----BEGIN Certificate-----" and "-----End certificate-----",
The 2_www.domain.com.key file includes a section of the private key code "-----BEGIN RSA private key-----" and "-----End RSA private key-----.

Save the first paragraph of 1_DOMAIN.COM_CERT.CRT code in a CRT-formatted file DOMAIN.CRT, and the second paragraph is pasted into a text that is saved in CRT format.

File CA.CRT.
(If it is a three-paragraph cross certificate, save the second and third paragraphs as CA.CRT)

Edit the conf/httpd.conf file under the Apache root directory,
Find #LoadModule ssl_module modules/mod_ssl.so and #Include conf/extra/httpd-ssl.conf, and remove the front # annotation;
Edit the conf/extra/httpd-ssl.conf file under the Apache root directory and modify the following

www.domain.com:443> documentroot "/var/www/html"

ServerName www.domain.com Sslengine on
Sslcertificatefile/usr/local/apache/conf/domain.crt
Sslcertificatekeyfile/usr/local/apache/conf/2_domain.com.key
Sslcertificatechainfile/usr/local/apache/conf/ca.crt
Once the configuration is complete, you can restart Apache to use https://www.domain.com to access the

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.