Nginx Server configuration support for HTTPS

Source: Internet
Author: User

1. Installation
Nginx to install the Http_ssl_module module, the OpenSSL library and related development packages are required, so these support must be installed before installation
Under the CentOS system, install directly with Yum: # Yum installs OpenSSL Openssl-devel
Compiling Nginx
# TAR-ZXVF Pcre-8.12.tar.gz
# CD pcre-8.12
#./configure–prefix=/usr/local
# make
# make Install
# TAR-ZXVF Nginx-1.0.0.tar.gz
# CD nginx-1.0.0
#./configure–prefix=/usr/local/nginx–user=www–group=www–with-http_ssl_module–with-pcre
# make
# make Install

2. Making key (single authentication)
# Mkdir/usr/local/nginx/ssl
# Cd/usr/local/nginx/ssl
# OpenSSL Genrsa-des3-out server.key 1024 (set up the server private key, you need to enter the passphrase in this process, you need to remember this password)
# OpenSSL Req-new-key server.key-out SERVER.CSR
After entering the command, you need to fill in the following:
Country Name (Country: China fill cn)
State or province Name (region or province: Chongqing)
Locality name (region local name: Chongqing)
Organization Name (institution name: Fill in Company name)
Organizational Unit name (organizational unit: Department name)
Common Name (website domain name)
Email address (e-mail)
A challenge password (enter a password)
An optional corporation name (an optional company name)
After entering this, the SERVER.CSR file is generated in the current directory
# CP Server.key server.key.org
# OpenSSL rsa-in server.key.org-out Server.key (for using the above private key to start an Nginx with SSL function)
# OpenSSL x509-req-days 365-in server.csr-signkey server.key-out server.crt (the certificate is signed with the above key and CSR

name)

Edit the Nginx configuration file that requires the domain name of HTTPS (the name of the common name website that was filled in)
server {
 server_name www.xxx.com;
 ssl on;
 SSL_CERTIFICATE/USR/LOCAL/NGINX/SSL/SERVER.CRT;
 ssl_certificate_key/usr/local/nginx/ssl/server.key;
}

Save, restart Nginx, so that a simple HTTPS service website (single authentication) is built.

Nginx Server configuration 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.