Nginx SSL Certificates deployed in and redirected to HTTPS tutorial

Step one: Download file Nginx version of the certificate, after decompression can see a .key file and the .crt / .pem file
  
Step two: Upload certificate. Above file upload .key and .crt / .pem file to the / root directory named ssl.crt / ssl.pem and ssl.key
  
Step Three: LNMP a key Nginx configuration package installed in / usr / local / nginx / conf / vhost / directory, find the corresponding site domain configuration files (such as anxinssl.com). Ordinary installed Nginx configuration file /etc/nginx/nginx.conf. vi command to enter the changes.
  
  Modify it:
  
  Server {
  the listen 443;
  server_name anxinssl.com  HTTP: //www.anxinssl.com; #  modify your domain
  ssl ON;
  root HTML;
  index index.html index.htm;
  ssl_certificate / root / ssl. PEM;
  ssl_certificate_key /root/ssl.key;
  ssl_session_timeout 5m;
  ssl_ciphers to the RSA-ECDHE-the AES128-GCM-the SHA256: ECDHE: the ECDH: the AES: HIGH: NULL: aNULL: the MD5: of ADH: the RC4;!!!!!
  ssl_protocols TLSv1 TLSv1 .1 TLSv1.2;
  ON ssl_prefer_server_ciphers;
  LOCATION / {
  the root HTML;
  index index.html index.htm;
  }
  }
  
Step Four: 301 is provided to redirect the HTTPS
  
  Server
  {
  the listen 80;
  server_name anxinssl.com  http://www.anxinssl.com;  # modify your domain
  rewrite ^ / (*.)  https://anxinssl.com/$1  Permanent; # if your site is the www, add www before the domain name
  }
  Server
  {
  the listen 443;
  # ...... The remaining configuration ibid.
  }

Guess you like

Origin www.cnblogs.com/mywl1115/p/12022063.html