nginx: https

1、编译

./configure –prefix=/usr/local/nginx-1.8\ –with-http_stub_status_module\ (统计数据查看) –with-pcre=/opt/install/nginx/pcre-8.44\ (正则) –with-http_sub_module\ –add-module=/opt/install/nginx/nginx-delay-module-master\ (delay)
–with-http_ssl_module (for https)  

2、配置

http {

    log_format  main  ‘$remote_addr – $remote_user [$time_local] “$request” ‘

                      ‘$status $body_bytes_sent “$http_referer” ‘

                      ‘”$http_user_agent” “$http_x_forwarded_for”
“$https”‘;

    server {

        listen       443 ssl;

        server_name  www.test.com;

        ssl_certificate      /home/judy/ssl/test.com.pem;

        ssl_certificate_key  /home/judy/ssl/test.com.key;

        #ssl_session_cache    shared:SSL:1m;

        #ssl_session_timeout  5m;

        #ssl_ciphers  HIGH:!aNULL:!MD5;

        #ssl_prefer_server_ciphers  on;

        location / {

            root   html;

            index  index.html index.htm;

        }

    }   说明: 内置变量$https:
如果开启了SSL安全模式,值为“on”,否则为空字符串。