Nginx Configuration HTTPS

Source: Internet
Author: User

HTTPS configuration Scenario

Key generation Operation steps

1. Generate Key key
2. Generate a Certificate signing request file (CSR file)
3. Generate a certificate signature file (ca file)

1. Check the current environment

OpenSSL must be 1.0.2[[email protected] ~]# OpenSSL Versionopenssl 1.0.2k-fips  

2. Create a private key

[[email protected] ssl]# OpenSSL genrsa-idea-out server.key 2048Generating RSA private key, 2048 bit long modulus.....++ +//Remember configure password, I here is 1234Enter pass phrase for Server.key:verifying-enter pass phrase for Server.key:

3. Generate self-signed certificate using signature request certificate and private key

[email protected] ssl]# OpenSSL req-days 36500-x509-sha256-nodes-newkey rsa:2048-keyout server.key-out SERVER.CRTC Ountry Name (2 letter code) [Xx]:cnstate or province name (full name) []:szlocality name (eg, city) [Default City]:szorgan  ization name [eg, company] [Default company ltd]:edu    organizational Unit Name (eg, section) []:sacommon name (eg, your Name or your server ' s hostname) []:xuli Email Address []:[email protected]

4. Configure Nginx-accessed configuration files

server {Listen 443;    server_name localhost;    SSL on;    Index index.html index.htm index.php;    #ssl_session_cache share:ssl:10m;    Ssl_session_timeout 10m;    SSL_CERTIFICATE/USR/LOCAL/NGINX/CONF/SSL/SERVER.CRT;    Ssl_certificate_key/usr/local/nginx/conf/ssl/server.key; Ssl_ciphers ecdhe-rsa-aes128-gcm-sha256:ecdhe:ecdh:aes:high:! null:!anull:! md5:! Adh:!    RC4;    Ssl_protocols TLSv1 TLSv1.1 TLSv1.2;        Ssl_prefer_server_ciphers on;  Location/{Access_log/data/wwwlogs/www.ikmak.com_nginx.log combined;  Index index.html index.htm index.php;        Root/data/wwwroot/default;    } location ~ [^/]\.php (/|$) {#fastcgi_pass remote_php_ip:9000;    Fastcgi_pass Unix:/dev/shm/php-cgi.sock;    Fastcgi_index index.php;    Include fastcgi.conf;    Fastcgi_split_path_info ^ (. +\.php) (/.+) $;    Fastcgi_param path_info $fastcgi _path_info;  Fastcgi_param script_filename $document _root$fastcgi_script_name;        }}server {Listen 80; Server_Name LocalHost Rewrite ^ (. *) https://$server _name$1 redirect;}

  

Nginx Configuration 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.