柳暗花明笔记

    Nginx + https + 免费SSL证书配置 HttpSslModule

    所属分类:[ linux&mysql ] 猫哲学家 发表于:2012-09-13 16:40 浏览:529

    Generate Certificates
    To generate private (dummy) certificates you can perform the following list of openssl commands.

    First change directory to where you want to create the certificate and private key, for example:

    $ cd /usr/local/nginx/conf
    Now create the server private key, you'll be asked for a passphrase:

    $ openssl genrsa -des3 -out server.key 1024
    Create the Certificate Signing Request (CSR):

    $ openssl req -new -key server.key -out server.csr
    Remove the necessity of entering a passphrase for starting up nginx with SSL using the above private key:

    $ cp server.key server.key.org
    $ openssl rsa -in server.key.org -out server.key
    Finally sign the certificate using the above private key and CSR:

    $ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
    Update Nginx configuration by including the newly signed certificate and private key:

    server {
        server_name YOUR_DOMAINNAME_HERE;
        listen 443;
        ssl on;
        ssl_certificate /usr/local/nginx/conf/server.crt;
        ssl_certificate_key /usr/local/nginx/conf/server.key;
    }
    Restart Nginx.

    http://wiki.nginx.org/NginxHttpSslModule

    标签: nginx 
    上一编文章 mysql if 语句 下一编文章 PHP判断SSL是否启用,也就是判断HTTPS
    最近文章
    发表评论