Centos下nginx支援https協議

來源:互聯網
上載者:User

標籤:https

1、首先配置nginx及其他外掛程式,這個Google下,很多配置方案。2、設定管理員的認證。操作步驟如下:[[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、配置nginx的conf檔案#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、開啟iptables的443連接埠


Centos下nginx支援https協議

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.