CentOS under Nginx Support HTTPS protocol

Source: Internet
Author: User

1, the first configuration nginx and other plug-ins, this Google, a lot of configuration options. 2. Configure the server's certificate. The following steps are:[[email protected] ~]# cd /etc/pki/tls/certs [[email protected]  certs]# make server.key umask 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[[email  Protected] certs]# openssl rsa -in server.key -out server.key enter  pass phrase for server.key:# input passphrasewriting rsa key[[email  protected] certs]#[[email protected] certs]# make server.csr umask 77 ; /usr/bin/openssl req -utf8 -new -key server.key -out  Server.csryou are about to be asked to enter information that  will be incorporatedinto your certificate request. what you are about to enter is what is called a  Distinguished 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     #companyOrganizational  Unit Name  (eg, section)  []:Test Haha     #departmentCommon  Name  (eg, your server ' S hostname)  []:www.test.com     #server ' s fqdnemail address []:[email protected] # email  addressplease enter the following  ' Extra '  attributesto be sent with  your certificate requesta challenge password []:# enteran optional  company name []:# Enter[[email protected] certs]#[[email protected]  Certs]# openssl x509 -in server.csr -out server.crt -req -signkey  server.key -days 3650Signature oksubject=/C=CN/ST=Beijing/L=Beijing/O=Test/OU=Test  Haha/cn=www.test.com,/[email protEcted] getting private key[[email protected] 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  / {       root   /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 5m;       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  1h;       }      access_log /data/log/ nginx/happy.access.log access;      error_log /data/log/nginx/ Happy.error.log warn;     }4, open the iptables 443 port


CentOS under Nginx Support HTTPS protocol

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.