CentOS6.5 Add SSL Certificate in Nginx to support HTTPS protocol access

Source: Internet
Author: User
Tags install openssl ssl certificate password protection nginx ssl

Reference documents:

1. NginxV1.8.0 Installation and Configuration

2. Add SSL Certificate in Nginx under CentOS to support HTTPS protocol access

3. How to configure the SSL certificate for Nginx

4, Nginx forced to use HTTPS access (HTTP jump to HTTPS)

5, Nginx SSL 107 (NET::ERR_SSL_PROTOCOL_ERROR) cannot establish a secure connection solution with the server

The configuration process is as follows:

My nginx is Yum installation specific installation process reference: [Go]centos 6.5 Configure yum install nginx+ server load Balancer

First, install the relevant support library: (Reference NginxV1.8.0 installation and configuration )
Yum-y Install gcc gcc-c++ autoconf
Yum-y Install OpenSSL Openssl-devel

Update to the latest support library

Second, edit the configuration file

# Vim/etc/nginx/conf.d/default or vim/etc/nginx/conf.d/example_ssl.conf

Mine is vim/etc/nginx/conf.d/example_ssl.conf .

Configuration examples

# HTTPS Server # server {    Listen       443 ;    server_name  localhost;    SSL on  ;    Ssl_certificate      /etc/nginx/ssl/xx.com.crt;    Ssl_certificate_key  /etc/nginx/ssl/xx.com.key;    Ssl_session_cache shared:ssl:1m;    Ssl_session_timeout  5m;    Ssl_ciphers High  :!anull:! MD5;    Ssl_prefer_server_ciphers on   ;     / {        root   /usr/share/nginx/html;        Index  index.html index.htm;    }}

Three, restart Nginx, complete

sudo service nginx restart

The Pem pass phrase is typically queried during the restart process because the RSA private key file is protected with a passphrase. When the CA issued a certificate, set a password protection, in the case of knowing the secret word, you can use OpenSSL to remove the protection, restart Nginx will not prompt for the password.

Problems that may be encountered:

Four, Nginx forced to use HTTPS access (HTTP jump to HTTPS)

Configuration
server {      listen  ;      server_name test.com;       ........    Rewrite ^ (. *) $  https://$host $ permanent;  # Add this line to force a jump
......}

CentOS6.5 Add SSL Certificate in Nginx to support HTTPS protocol access

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.