Nginx in Centos supports https protocol

Source: Internet
Author: User

Nginx in Centos supports https protocol
1. Configure nginx and Other plug-ins first. There are many configuration solutions under Google. 2. Configure the server certificate. The procedure is as follows: [root @ localhost ~] # Cd/etc/pki/tls/certs [root @ localhost certs] # make server. keyumask 77; \/usr/bin/openssl genrsa-aes128 2048> server. keyGenerating RSA private key, 2048 bit long modulus .................................... .................. ++ ............. ++ e is 61251 (0x10001) Enter pass phrase: # set passphraseVerifying-Enter pass phrase: # confirm # remove passphrase from private key [root @ localhost certs] # Openssl rsa-in server. key-out server. keyEnter pass phrase for server. key: # input passphrasewriting RSA key [root @ localhost certs] # [root @ localhost certs] # make server. csrumask 77; \/usr/bin/openssl req-utf8-new-key server. key-out server. csrYou are about to be asked to enter information that will be inreceivatedinto your certificate request. what you are about to enter is what is called a Di Stinguished Name or a DN. there are quite a few fields but you can leave some blankFor some fields there will be a default value, If you enter '. ', the field will be left blank. ----- Country Name (2 letter code) [XX]: CN # countryState or Province Name (full name) [e]: Beijing # stateLocality Name (eg, city) [Default City]: beijing # cityOrganization Name (eg, company) [Default Company Ltd]: Test # companyOr Ganizational Unit Name (eg, section) []: Test Haha # departmentCommon Name (eg, your server's hostname) []: www.test.com # server's FQDNEmail Address []: admin@test.com # email addressPlease enter the following 'extra 'attributesto be sent with your certificate requestA challenge password []: # EnterAn optional company name []: # Enter [root @ localhost certs] # [root @ localhost certs] # openssl x509-in server. Csr-out server. crt-req-signkey server. key-days 3650 Signature oksubject =/C = CN/ST = Beijing/L = Beijing/O = Test/OU = Test Haha/CN = www.test.com, /emailAddress = admin@test.comGetting Private key [root @ localhost certs] # chmod 400 server. * 3. Configure the nginx conf file # server {# listen 80; # server_name happy.cc.com; # rewrite ^ (. *) $ permanent; #} server {listen 80; listen 443 ssl; server_name happy.cc.com; location/{roo T/data/www/cloud; index index.html;} ssl on; ssl_certificate/data/webserver/nginx/conf/server. crt; ssl_certificate_key/data/webserver/nginx/conf/server. key; ssl_session_timeout 5 m; ssl_protocols SSLv3 TLSv1; ssl_ciphers ALL :! ADH :! EXPORT56: RC4 + RSA: + HIGH: + MEDIUM: + LOW: + SSLv2: + EXP; ssl_prefer_server_ciphers on; # autoindex on; location =/favicon. ico {log_not_found off; access_log off;} location ~ \. Php $ {root/data/www/cloud; fastcgi_pass unix:/tmp/php-cgi.sock; # fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; fastcgi_param SCRIPT_FILENAME/data/www/cloud $ fastcgi_script_name; include fastcgi_params;} location ~. * \. (Gif | jpg | jpeg | png | bmp | swf) \ $ {expires 30d;} location ~. * \. (Js | css )? \ $ {Expires 1 h;} access_log/data/log/nginx/happy. access. log access; error_log/data/log/nginx/happy. error. log warn;} 4. open port 443 of iptables

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.